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

Multi-reddit navbar links are broken #5525

Open
Kushagra-0801 opened this issue May 31, 2024 · 0 comments
Open

Multi-reddit navbar links are broken #5525

Kushagra-0801 opened this issue May 31, 2024 · 0 comments

Comments

@Kushagra-0801
Copy link

What's the problem?
The multi-reddit navbar links are broken.

Are there any related posts in https://github.com/honestbleeps/Reddit-Enhancement-Suite/issues or /r/RESissues?
Couldn't find any.

What other browser extensions are installed?
Ublock Origin and a few more unrelated ones.

Possible root cause
In file (

) the values are given as relative paths (./ prepended).

These are directly appended to the base url of the multi reddit (

const li = string.html`<li><a href="${baseUrl}${url}">${label}</a></li>`;
), leading to broken links.

Suggestion

Use the following fragment for creating the element:

const normalizedBaseUrl = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
const fullUrl = (new URL(url, normalizedBaseUrl)).href;
const li = string.html`<li><a href="${fullUrl}">${label}</a></li>`;

I would have made a PR but I do not have the setup on my laptop for running code.

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

No branches or pull requests

1 participant