Skip to content

Commit 80dd587

Browse files
mkatychevricochet
andauthored
Apply suggestions from code review
Co-authored-by: Bailey Hayes <ricochet@users.noreply.github.com>
1 parent 8e1c617 commit 80dd587

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

crates/wasm-pkg-core/src/lock.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ impl PartialEq for LockFile {
4848
self.packages == other.packages && self.version == other.version
4949
}
5050
}
51+
/// Compares a [`LockFile`] against a `(version, packages)` snapshot. This is used to
52+
/// detect whether a build would mutate the lock file (e.g. before publishing) without
53+
/// having to hold a second [`LockFile`].
5154
impl PartialEq<(u64, BTreeSet<LockedPackage>)> for LockFile {
5255
fn eq(&self, other: &(u64, BTreeSet<LockedPackage>)) -> bool {
5356
self.packages == other.1 && self.version == other.0

crates/wkg/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,12 @@ impl PublishArgs {
285285
});
286286
}
287287

288+
// Sanitize the package ref for use as a filename prefix: `namespace:name`
289+
// contains characters (`:`, `/`) that are invalid in filenames on some
290+
// platforms (notably Windows).
291+
let prefix: String = build_ref.to_string().replace([':', '/'], "_");
288292
let tmp = tempfile::Builder::new()
289-
.prefix(&build_ref.to_string())
293+
.prefix(&prefix)
290294
.suffix(".wasm")
291295
.tempfile()
292296
.context("Failed to create temporary file for built WIT package")?;

0 commit comments

Comments
 (0)