Skip to content

Commit b9ca108

Browse files
tcrMichael-F-Bryan
authored andcommitted
Support reproducible builds by forcing window.search to use stable key ordering. (#692)
1 parent 7ee5b66 commit b9ca108

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/renderer/html_handlebars/search.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ fn write_to_js(index: Index, search_config: &Search) -> Result<String> {
205205
searchoptions,
206206
index,
207207
};
208+
209+
// By converting to serde_json::Value as an intermediary, we use a
210+
// BTreeMap internally and can force a stable ordering of map keys.
211+
let json_contents = serde_json::to_value(&json_contents)?;
208212
let json_contents = serde_json::to_string(&json_contents)?;
209213

210214
Ok(format!("window.search = {};", json_contents))

0 commit comments

Comments
 (0)