SCSS variables referencing uploads broken in subfolder installs

Hi there,

After installing Discourse into a subfolder using DISCOURSE_RELATIVE_URL_ROOT, and then using a custom variable that references an uploaded file in Admin -> Customize -> Themes -> Edit CSS/HTML, the URL generated in the CSS is wrong.

For example, if DISCOURSE_RELATIVE_URL_ROOT is /my/forum, the CSS generates a URL that looks like /my/forum/my/forum/uploads/default/original/1X/... (note the repeated relative URL root).

If S3 is used, the URL generated looks like /my/forum//something.dualstack.s3.amazonaws.com/uploads/default/original/1X/....

As a workaround, using an absolute URL (with the appropriate CORS configuration on S3) works.

3 Likes

@tgxworld is that something that will be solved by your PR?

https://github.com/discourse/discourse/pull/6573

1 Like

It wouldn’t solve the problem here since the PR deals only with site settings. @sam might have a better idea here since he worked on the upload assets support in themes.

1 Like

@nbianca can you add that to your list? Makes sure you test both local and S3 uploads when using subfolder.

2 Likes

Fixed by

https://github.com/discourse/discourse/pull/6622

5 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.