Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed Display not selecting approprate link for Blogger Atom Feeds #38631

Closed
brockpalen opened this issue Aug 29, 2022 · 5 comments
Closed

Feed Display not selecting approprate link for Blogger Atom Feeds #38631

brockpalen opened this issue Aug 29, 2022 · 5 comments

Comments

@brockpalen
Copy link

Steps to reproduce the issue

  1. Create new Feed Display module
  2. Set Feed URL to a Blogger Atom Feed eg https://www.failureasaservice.com/feeds/posts/default

Expected result

Links should use the <link rel="alternate"> entry creating a clickable jump back to the Blogger page.

Actual result

Link is created using the first entry <link rel="replies"> which is an XML feed and not useful for normal users who just want to jump over to your post on Blogger.com.

<link rel="replies" type="application/atom+xml" href="https://www.failureasaservice.com/feeds/921417709640098202/comments/default" title="Post Comments"/>
    <link rel="replies" type="text/html" href="https://www.failureasaservice.com/2020/10/amd-killed-arm-in-data-center.html#comment-form" title="0 Comments"/>
    <link rel="edit" type="application/atom+xml" href="https://www.blogger.com/feeds/3991757369876144735/posts/default/921417709640098202"/>
    <link rel="self" type="application/atom+xml" href="https://www.blogger.com/feeds/3991757369876144735/posts/default/921417709640098202"/>
    <link rel="alternate" type="text/html" href="https://www.failureasaservice.com/2020/10/amd-killed-arm-in-data-center.html" title="AMD Killed ARM in the Data Center"/>

System information (as much as possible)

Joomla 4.1.5

Additional comments

The Blogger.com feed validates over at W3C,

@brockpalen
Copy link
Author

Ok figured out some what is going on,

AtomParser.php in with newer versions of PHP (assumption) doesn't behave as expected,

Specificaly in processFeedEntry it has

if (\is_array($link))

But that won't work because it returns an instance of SimpleXMLElement and not an array so the first entry it taken.

If it's changed to:

if ($link->count() > 1)

It now enters the IF statement correctly for bestLInkForUri Note it also needs to have it's prototype updated to be

private function bestLinkForUri(\SimpleXMLElement $links)

Rather than array or it will error.

Lastly

$linkPrefs = array('', 'self', 'alternate');

Needs to be updated to

$linkPrefs = array('alternate', 'self', '');

To get the expected behavior. Not sure everyone wants that behavior and it should probably be changed to a param? Not sure.

Lastly title links have the same issues and in AtomParser.php again

protected function handleLink(Feed $feed, \SimpleXMLElement $el)

Grabs just the first link which again isn't least astonishment behavior on Blgoger generated feeds. I just disabled showing the title.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38631.

@Hackwar
Copy link
Member

Hackwar commented Jan 24, 2024

Thank you for your reported issue and all the work you did. I created a PR out of this. Please test the PR #42706 and then can this be fixed in one of the next releases.

Closing issue since we have a PR.

@Hackwar Hackwar closed this as completed Jan 24, 2024
@brockpalen
Copy link
Author

Great thanks, I just tested the change and it works perfectly. Appreciate it.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38631.

@Hackwar
Copy link
Member

Hackwar commented Jan 29, 2024

Can you please mark the PR as tested by you? We need 2 successfull tests to be able to merge this and with yours we would be done. 😉

@brockpalen
Copy link
Author

So not sure if this is the right place but a quick google all I find is this page:

https://docs.joomla.org/Testing_Joomla!_patches

And I don't see a TestThis, so I'm not sure how you want me to flag that. Sorry first time reporting.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38631.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants