From 048c99ebccff4805e5515eaf32ecdab98d17dfd9 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Thu, 20 Aug 2026 20:09:19 +0200 Subject: [PATCH] fix(downloads): allow the deliberate join_absolute_paths lint in a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The assertion documents that PathBuf::join discards its base when handed an absolute path — which is why confinement has to happen after the join, not instead of it. clippy::join_absolute_paths flags that shape, correctly for production code, so the lint is allowed here rather than the test weakened. Worth recording: this lint would not have caught the original defect. The real join sites pass a variable, and it only fires on a literal. --- src-tauri/src/commands/download/mod.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/commands/download/mod.rs b/src-tauri/src/commands/download/mod.rs index cde58859..0ccfed11 100644 --- a/src-tauri/src/commands/download/mod.rs +++ b/src-tauri/src/commands/download/mod.rs @@ -2568,10 +2568,19 @@ mod tests { // Why the absolute case needs its own guard rather than folding: the // join the download path performs discards the base entirely. - assert_eq!( - PathBuf::from(root).join("/etc/cron.d/pwn"), - PathBuf::from("/etc/cron.d/pwn") - ); + // + // clippy::join_absolute_paths flags exactly this shape, and is right to + // in production code — here the discarded base *is* the assertion, so + // the lint is allowed rather than the code changed. Note the lint would + // not have caught the original defect: the real join sites take a + // variable, and the lint only fires on a literal starting with `/`. + #[allow(clippy::join_absolute_paths)] + { + assert_eq!( + PathBuf::from(root).join("/etc/cron.d/pwn"), + PathBuf::from("/etc/cron.d/pwn") + ); + } } /// The paths the app builds for itself have to survive unchanged: files are