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

Relative links/URLs don't open correctly #1605

Closed
3 tasks done
Farzat07 opened this issue Dec 8, 2021 · 5 comments
Closed
3 tasks done

Relative links/URLs don't open correctly #1605

Farzat07 opened this issue Dec 8, 2021 · 5 comments

Comments

@Farzat07
Copy link

Farzat07 commented Dec 8, 2021

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

What problem did you encounter?

Relative links are handled as if they are relative to the news app, whereas they should be relative to the article's url.

Steps to Reproduce

Explain what you did to encounter the issue

  1. Add a feed which uses relative URLs (e.g. https://lukesmith.xyz/rss.xml).
  2. Open an article which contains a relative URL (e.g. Matrix vs. XMPP).
  3. Open the relative URL by pressing 1 (or the corresponding key).

Example article URL: https://lukesmith.xyz/articles/matrix-vs-xmpp.html
1st link (target): ../pix/xmpp.svg

Expected behaviour: The relative link is appended to the article's URL to give https://lukesmith.xyz/pix/xmpp.svg

Actual behaviour: The relative link is appended to the news app's URL to give https://cloud.farzat.xyz/apps/pix/xmpp.svg

System Information

  • News app version: 17.0.0
  • Nextcloud version: 22.2.3
  • Cron type: system cron
  • PHP version: 7.4
  • Database and version: mysql Ver 15.1 Distrib 10.3.29-MaraiDB
  • Browser and version: qutebrowser v2.4.0 & Librewolf 94.0.2
  • OS and version: Arch linux. Server Ubuntu 20.04
Contents of nextcloud/data/nextcloud.log
Paste output here
Contents of Browser Error Console Read http://ggnome.com/wiki/Using_The_Browser_Error_Console if you are unsure what to put here
Paste output here
@Farzat07 Farzat07 added the bug label Dec 8, 2021
@Farzat07
Copy link
Author

Farzat07 commented Dec 8, 2021

Hint: You can see a fix to a similar problem here: newsboat/newsboat#1818.

@Grotax
Copy link
Member

Grotax commented Dec 8, 2021

Yea I don't think this is something that can be "fixed", it is not a good practice to include relative links in the feed content as the feed is usually not read on the website itself.

To solve this I guess that news would need to check and modify every URL in the feed if it is relative to adjust it to an absolute (guessed) URL and save the modified content to the dB. So that clients get the absolute path.
But then there might be corner cases and those will make the code more complicated.

This might also impact performance heavily.

Maybe the feed author also wants it that way so that you have to manually go to the website.. .

@Farzat07
Copy link
Author

Farzat07 commented Dec 8, 2021

Actually I think it is fine to fix the urls at the client level: modifying the db makes mistakes more difficult to fix later. For now just the browser code needs to be modified, and later other clients can also fix the problem in their own projects (if they haven't already).

This means that one only need to fix the urls in the current message as it opens: not very intensive. Probably there is even some logic going on anyway to determine how to display the links, which can simply be modified to fix relative links on the go.

While absolute paths might be more ideal in an rss feed, I believe having relative links is not something which can be easily avoided and is somewhat justified: many people when writing the rss feeds for their websites would simply copy and paste the html code from their website (because you can insert html in rss so it is convenient). Relative links in websites is actually a good practice, but unfortunately this ends up getting carried on to the rss, leading to this mess. Modifying the links when moving them to rss is not something everyone is going to think of, is easy to miss at places, and might actually take some good amount of manual effort (if the feed is written by hand for example).

However, once one understands where the problem is originating from, it can be easily dealt with. Relative links simply need to be treated as if they exist on the main article. In the case of newsboat, all it took is one additional if statement (literally two lines of code): newsboat/newsboat#1823.

@Grotax
Copy link
Member

Grotax commented Dec 8, 2021

Hmm yea true the clients could also handle it.

I don't work on the front-end though no idea.
Unfortunately it's also very outdated, the base framework angularjs is deprecated and support ends this year, not sure what will happen after that.

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

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

2 participants