Atom feeds use relative links for image attachments?

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
CarstenF
Registered User
Posts: 33
Joined: Sat Jun 28, 2008 8:55 pm

Atom feeds use relative links for image attachments?

Post by CarstenF »

Hi all,

using phpBB 3.1.5 with the built-in Atom feeds, I found that inline image attachments use relative links.

For example, please see http://forum.cafu.de/feed.php?mode=news [EDIT: This site now has this patch applied, so the issue can no longer be reproduced/observed there!]

Its source code contains:

Code: Select all

<div class="inline-attachment">
  <dl class="thumbnail">
    <dt>
      <a href="./download/file.php?id=259&sid=e274fff03c06a976c0d1ccb67985bbad&mode=view">
        <img src="./download/file.php?id=259&t=1&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:

Code: Select all

		// 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?

Some loosely related links: (Btw. 1, the sid=... parameter should not be there either, should it?)

(Btw. 2, the Support Forum's description says not to post bug reports there... I hope this is right here?)

Best regards,
Carsten
Last edited by CarstenF on Mon Jul 06, 2015 9:49 pm, edited 1 time in total.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26847
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Atom feeds use relative links for image attachments?

Post by Paul »

CarstenF wrote:(Btw. 2, the Support Forum's description says not to post bug reports there... I hope this is right here?)
No, you should report bugs to the bugtracker at http://tracker.phpbb.com/
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development
CarstenF
Registered User
Posts: 33
Joined: Sat Jun 28, 2008 8:55 pm

Re: Atom feeds use relative links for image attachments?

Post by CarstenF »

Ok, done:
https://tracker.phpbb.com/browse/PHPBB3-13988

Best regards,
Carsten
Post Reply

Return to “Extension Writers Discussion”