Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-13988

Atom feeds use relative links for image attachments

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.1.5
    • 3.1.7-RC1
    • Other
    • None
    • phpBB 3.1.5, php 5.4.42, Firefox 38.0.5

    Description

      Using phpBB 3.1.5 with the built-in Atom feeds, inline image attachments use relative links.

      For an example, please see http://forum.cafu.de/feed.php?mode=news

      Its source code contains:

      <div class="inline-attachment">
        <dl class="thumbnail">
          <dt>
            <a href="./download/file.php?id=259&amp;sid=e274fff03c06a976c0d1ccb67985bbad&amp;mode=view">
              <img src="./download/file.php?id=259&amp;t=1&amp;sid=e274fff03c06a976c0d1ccb67985bbad" class="postimage" alt="BPWxBeta_MasterLift.jpg" title="BPWxBeta_MasterLift.jpg (16.29 KiB) Viewed 139 times" />
            </a>
          </dt>
        </dl>
      </div>
      

      Even though some feed readers seem to be able to deal with such relative links correctly, it still looks to me as if the URLs both in the a and img tags should be absolute, not relative?

      (The feed also uses the xml:base attribute, but if I understand this correctly, this is not actually related to solving (or causing) this problem.)

      The related phpBB source file is phpBB/feed/helper.php, which has this section of code:

      		// Parse inline images to display with the feed
      		if (!empty($post_attachments))
      		{
      			$update_count = array();
      			parse_attachments($forum_id, $content, $post_attachments, $update_count);
      			$post_attachments = implode('<br />', $post_attachments);
       
      			// Convert attachments' relative path to absolute path
      			$post_attachments = str_replace($this->phpbb_root_path . 'download/file.' . $this->phpEx, $this->get_board_url() . '/download/file.' . $this->phpEx, $post_attachments);
       
      			$content .= $post_attachments;
      		}
      

      but something seems wrong here – the final statement $content .= $post_attachments; seems to indicate that this code is for "non-inline" attachments, not "inline" attachments?

      (Btw., the sid=... parameter should not be there either, should it?)

      Originally reported in thread https://www.phpbb.com/community/viewtopic.php?f=461&t=2324921

      Attachments

        Activity

          People

            nicofuma nicofuma
            CarstenF CarstenF [X] (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: