Reddit-Enhancement-Suite icon indicating copy to clipboard operation
Reddit-Enhancement-Suite copied to clipboard

RES rewrites relative links, breaking some subreddit styles and RES spoilers

Open ReneZeidler opened this issue 4 years ago • 3 comments

  • My browser: Firefox 75 on Windows 10
  • My RES version: 5.18.11
  • Am I in reddit beta (yes/no): yes

What's the problem? RES rewrites relative links everywhere (like /r/test) to full URLs (like https://www.reddit.com/r/test). Some subreddits use relative links to make custom emotes, e.g. [](/example), which are then styled using the CSS rule a[href^="/example"]. After RES rewrites the links, the CSS rule no longer matches and the emotes aren't visible. The same happens for hash-links (like [](#example)).

This also breaks some CSS included with RES itself, the old spoiler syntax ([Hidden text](/s) or [Hidden text](#s)).

Examples Without RES, emotes are visible: https://www.reddit.com/r/mylittlepony/wiki/emote_guide#res:disabled With RES, emotes are not visible: https://www.reddit.com/r/mylittlepony/wiki/emote_guide Old style spoilers no longer work: https://www.reddit.com/r/Rene_Z/comments/ftaou4/res_spoiler_test/


The issue was likely introduced by https://github.com/honestbleeps/Reddit-Enhancement-Suite/pull/4859, more precisely by commit https://github.com/honestbleeps/Reddit-Enhancement-Suite/pull/4859/commits/500ab2c61374bea126b47e241ba68191a27edbdd. The code is still in the current master: https://github.com/larsjohnsen/Reddit-Enhancement-Suite/blob/master/lib/options/settingsConsole.js#L68-L75

It's supposed to rewrite relative links in the settings console (since it is in an iframe outside of the reddit.com domain), but apparently it also gets executed outside of the settings console iframe. At least I couldn't find any other code that could cause this issue when searching through the repo.

Since the code is an a base module, there is no setting to disable it as a workaround.


Are there any related posts in https://github.com/honestbleeps/Reddit-Enhancement-Suite/issues or /r/RESissues? I couldn't find any previous reports of this issue.

What other browser extensions are installed? None relevant

ReneZeidler avatar Apr 01 '20 22:04 ReneZeidler

Can't seem to reproduce this behavior on old Reddit, RES 5.18.11, FF 74 on Win10, beta enabled, with a the "Lite" RES settings preset. Could it be an issue in FF 75? Have you tried any other browsers?

This is what I can observe in my environment, in the /r/mylittlepony wiki linked above:

image

And in the /r/Rene_Z test post:

image

eritbh avatar Apr 02 '20 01:04 eritbh

I cannot repo this on old Reddit FF 75 with RES enabled all at default. I see exactly the same as @geo1088 does in 74.

image

Can you please provide a list of extensions you have enabled and any config changes to Firefox outside of default.

We also do not rewrite all URLs, see picture below for a link to internal subreddit.

image

benmcgarry avatar Apr 02 '20 12:04 benmcgarry

After I had to reinstall Firefox recently, I remembered this issue when I restored my RES settings. I finally found out what caused my problem. The expandoCommentRedirects setting of showImages was set to rewrite for me. Changing it to expando or nothing fixed the issue for me.

I think the setting is only supposed to rewrite actual post links, it doesn't make sense for links inside self-posts or comments. But currently it still applies to expandos within posts and comments. With the setting set to rewrite, it effectively changes every reddit-internal URL to absolute URLs, so a link in a comment to "/example" gets rewritten into "https://www.reddit.com/example".

So changing the setting back to its default value fixed my issue, but I think it's not quite working as intended (or has unintended side effects).

ReneZeidler avatar Jul 01 '21 02:07 ReneZeidler