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

Change get_url(cachebust=true) to use a hash #1032

Merged
merged 2 commits into from
May 23, 2020
Merged

Conversation

dancek
Copy link
Contributor

@dancek dancek commented May 18, 2020

Cache-busting was previously done with a compile-time timestamp. Change
to the SHA-256 hash of the file to avoid refreshing unchanged files.

The implementation could be used to add a new global fn (say,
get_file_hash) for subresource integrity use, but that's for another
commit.

Fixes #519.

IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

Cache-busting was previously done with a compile-time timestamp. Change
to the SHA-256 hash of the file to avoid refreshing unchanged files.

The implementation could be used to add a new global fn (say,
get_file_hash) for subresource integrity use, but that's for another
commit.

Fixes getzola#519.
@dancek
Copy link
Contributor Author

dancek commented May 18, 2020

I'm not very seasoned with Rust, so I'll appreciate any review comments. Especially the TestContext part seems a bit questionable to me, but this way I think the directory should get cleaned up even when a test panics.

@dancek
Copy link
Contributor Author

dancek commented May 18, 2020

error: failed to run custom build command for `onig_sys v69.2.0`

I don't think this is caused by my changes. 🤔

@Keats
Copy link
Collaborator

Keats commented May 18, 2020

Don't worry about that, it's being fixed upstream.

@Keats Keats merged commit 36ec33f into getzola:next May 23, 2020
@Keats
Copy link
Collaborator

Keats commented May 23, 2020

Thanks!

@dancek dancek deleted the sha2-cachebust branch May 28, 2020 16:11
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