Skip to content

Fixes #3401 - Don't modify the file_path inside bust_cache#3407

Merged
miketaylr merged 1 commit intomasterfrom
issues/3401/2
Jul 21, 2020
Merged

Fixes #3401 - Don't modify the file_path inside bust_cache#3407
miketaylr merged 1 commit intomasterfrom
issues/3401/2

Conversation

@miketaylr
Copy link
Copy Markdown
Member

Actually fixes it this time.

(Modifying the file_path var had bad consequences for some of the files, they could end up as 404)

Screen Shot 2020-07-20 at 5 00 06 PM

r? @ksy36

@miketaylr miketaylr force-pushed the issues/3401/2 branch 2 times, most recently from 1f686e6 to 558507a Compare July 20, 2020 22:39
@miketaylr miketaylr requested a review from ksy36 July 20, 2020 22:46
Copy link
Copy Markdown
Contributor

@ksy36 ksy36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, just one nit-pick

if file_path.startswith('/'):
file_path = file_path[1:]
absolute_path = os.path.join(STATIC_PATH, file_path)
trimmed_file_path = file_path[1:]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not an expert, but maybe a bit shorter version:

    trimmed_file_path = file_path
    if file_path.startswith('/'):
        trimmed_file_path = file_path[1:]

    absolute_path = os.path.join(STATIC_PATH, trimmed_file_path)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, nicer. :)

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

Successfully merging this pull request may close these issues.

2 participants