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

About caching using whitenoise package #93

Closed
oussama-he opened this issue Oct 23, 2023 · 1 comment · Fixed by #96
Closed

About caching using whitenoise package #93

oussama-he opened this issue Oct 23, 2023 · 1 comment · Fixed by #96

Comments

@oussama-he
Copy link

According to the note about caching static files when serving them using the whitenoise package, you said that we should change the WHITENOISE_IMMUTABLE_FILE_TEST setting to consider the files generated by VITEJS to be cached.

But when looking at the regex it looks like it doesn't match the files generated by VITEJS because they are of this format: file-[hash].extname, where the separator between the file name and the hash is - not a period and the hash is 8 hexadecimal digits.

I'm missing a point or something is wrong?

@Niicck
Copy link
Collaborator

Niicck commented Oct 26, 2023

You are correct!

The regex in the note {8,12} does handle the case of 8 digits (and 12 digits, to not break compatibility with Django's ManifestStaticFilesStorage). But you're correct that it's not accounting for a - separator. So the actual working regex should be:

^.+[\.\-][0-9a-f]{8,12}\..+$

Good catch!

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 a pull request may close this issue.

2 participants