mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-02 16:55:24 +00:00
fix(update): the update helper only restarts the app's own executable
check_helper accepted any existing file as a standalone install, so a differently named executable passed (the Windows test caught it). The program's name must be one of the app's own.
This commit is contained in:
1 file changed
+4
@@ -729,6 +729,10 @@ fn check_helper(app: &App, me: &Path, paths: &Paths, exe: &Path, step: &Finish)
|
||||
return Err(refused());
|
||||
}
|
||||
let exe = canonical(exe)?;
|
||||
// Whatever the folder, the program to restart is this app's own, never another executable.
|
||||
if !exe.file_stem().and_then(|stem| stem.to_str()).is_some_and(|stem| app.stems().any(|id| id.eq_ignore_ascii_case(stem))) {
|
||||
return Err(refused());
|
||||
}
|
||||
let downloads = canonical(&paths.downloads())?;
|
||||
let in_downloads = |file: &Path| canonical(file).map(|f| f.parent() == Some(downloads.as_path()));
|
||||
let allowed = match (detect(app, &exe), step) {
|
||||
|
||||
Reference in new issue
Block a user