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

fix(Hash-376): Hash should not be applied on inline.js #377

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/compile/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ fn compute_front_file_hashes(proj: &Project) -> Result<HashMap<Utf8PathBuf, Stri
}
}

// Check if the path contains snippets and also if it
// contains inline{}.js. We do not want to hash these files
// as the webassembly will look for an unhashed version of
// the .js file. The folder though can be hashed.
if let Some(path_str) = path.to_str() {
if path_str.contains("snippets") {
if let Some(file_name) = path.file_name() {
let file_name_str = file_name.to_string_lossy();
if file_name_str.contains("inline") {
if let Some(extension) = path.extension() {
if extension == "js" {
continue;
}
}
}
}
}
}

let hash = Base64UrlUnpadded::encode_string(
&Md5::new().chain_update(fs::read(&path)?).finalize(),
);
Expand Down
Loading