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

Add root to all static asset paths that mis it #5229

Conversation

HendrikPetertje
Copy link

@HendrikPetertje HendrikPetertje commented Oct 23, 2020

What type of PR is this? (check all applicable)

  • Bug Fix

Description

Static assets are already prefixed with the root denomination in most of
Redash. There are just a few places where these paths are missing.
Normally this doesn't really matter if Redash is used like most people
do with the Open Source edition.

We however had to toggle the organizations feature on (using REDASH_MULTI_ORG),
at which point a prefixed organisation "name-slug" is added before all
page paths (http://localhost:5000/org_a/).

Now the static assets without root path were suddenly expected to be in
our organizations respective slug-namespace.
(http://localhost:5000/org_a/static/images/db-logos/postgres.png for
example).

This pull update 6 cases of "wrongly routed"
asset paths to be in line with a "/" like the already existing cases listed below:

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Before the fix:
Screenshot 2020-10-23 at 09 50 27
Screenshot 2020-10-23 at 09 50 44
Screenshot 2020-10-23 at 09 51 06

After the fix:
Screenshot 2020-10-23 at 10 02 54
Screenshot 2020-10-23 at 10 03 03
Screenshot 2020-10-23 at 10 03 32

Static assets are already prefixed with the root denomination in most of
Redash. There are just a few places where these paths are missing.
Normally this doesn't really matter if Redash is used like most people
do with the Open Source edition.

We however had to toggle the organizations feature on (using REDASH_MULTI_ORG),
at which point a prefixed organisation "name-slug" is added before all
page paths (http://localhost:5000/org_a/).

Now the static assets without root path were suddenly expected to be in
our organizations respective slug-namespace.
(http://localhost:5000/org_a/static/images/db-logos/postgres.png for
example).

This Commit (and pull request) updates the 6 cases of "wrongly routed"
asset paths back to "/".
@HendrikPetertje HendrikPetertje changed the title Add root to all static asset paths that miss it Add root to all static asset paths that mis it Oct 23, 2020
@kravets-levko kravets-levko requested a review from arikfr October 23, 2020 08:42
@kravets-levko kravets-levko self-assigned this Oct 23, 2020
@kravets-levko
Copy link
Collaborator

@arikfr I requested your review because it's related to #5129

@HendrikPetertje
Copy link
Author

Hey there, @kravets-levko & @arikfr, what is the status of reviewing this?

I can continue to stay checked out on my own fork over on our EC3 instance for a while, but I'd much rather skip the overhead of having to merge in in future updates to my fork and instead just track your Github version without the asset bug ;)

@arikfr
Copy link
Member

arikfr commented Nov 2, 2020

@HendrikPetertje your change breaks other things. I don't mind making the base path configurable, so the default remains static/ while you can override it with /static, but we can't merge your PR as is.

@HendrikPetertje
Copy link
Author

HendrikPetertje commented Nov 16, 2020

I've been trying to figure out what would break, the only thing I've come up with so far where it breaks is if the entire Redash application sits in a sub-path (example.org/redash/...), But I needed to do some pretty awful unconventional stuff in NGinx to actually get there. I figure that anyone doing such in NGinx would need to add extra location paths to fix asset locations anyway.

Is this really a problem and would you be able to point me to what would actually break (if I'm overlooking things) if we merged this as is? If it is as broken as you say, then we should probably update most of the static JS & images paths that are already prefixed with a / (some of which I already mentioned above)

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

Successfully merging this pull request may close these issues.

3 participants