Fix 12 medium-severity bugs across all crates
- Escape backslashes in Nautilus preset names preventing Python injection - Fix tiled watermarks starting at (spacing,spacing) instead of (0,0) - Fix text watermark width overestimation (1.0x to 0.6x multiplier) - Fix output_dpi forcing re-encoding for metadata-only presets - Fix AVIF/WebP compression detection comparing against wrong preset values - Add shared batch_updating guard for Ctrl+A/Ctrl+Shift+A select actions - Fix overwrite conflict check ignoring preserve_directory_structure - Add changes_filename()/changes_extension() for smarter overwrite checks - Fix watch folder hardcoding "Blog Photos" preset - Fix undo dropping history for partially-trashed batches - Fix skipped files inflating size statistics - Make CLI watch config writes atomic
This commit is contained in:
@@ -573,25 +573,27 @@ fn cmd_undo(count: usize) {
|
||||
entry.total, entry.input_dir
|
||||
);
|
||||
|
||||
let mut batch_trashed = 0;
|
||||
let mut remaining_files = Vec::new();
|
||||
for file_path in &entry.output_files {
|
||||
let path = PathBuf::from(file_path);
|
||||
if path.exists() {
|
||||
match trash::delete(&path) {
|
||||
Ok(()) => {
|
||||
batch_trashed += 1;
|
||||
total_trashed += 1;
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!(" Failed to trash {}: {}", path.display(), e);
|
||||
remaining_files.push(file_path.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep entry in history if no files were trashed
|
||||
if batch_trashed == 0 {
|
||||
failed_entries.push(entry);
|
||||
// Keep entry with remaining files if some could not be trashed
|
||||
if !remaining_files.is_empty() {
|
||||
let mut kept = entry;
|
||||
kept.output_files = remaining_files;
|
||||
failed_entries.push(kept);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,7 +667,7 @@ fn cmd_watch_add(path: &str, preset_name: &str, recursive: bool) {
|
||||
}
|
||||
match serde_json::to_string_pretty(&watches) {
|
||||
Ok(json) => {
|
||||
if let Err(e) = std::fs::write(&watches_path, json) {
|
||||
if let Err(e) = pixstrip_core::storage::atomic_write(&watches_path, &json) {
|
||||
eprintln!("Failed to write watch config: {}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -743,7 +745,7 @@ fn cmd_watch_remove(path: &str) {
|
||||
|
||||
match serde_json::to_string_pretty(&watches) {
|
||||
Ok(json) => {
|
||||
if let Err(e) = std::fs::write(&watches_path, json) {
|
||||
if let Err(e) = pixstrip_core::storage::atomic_write(&watches_path, &json) {
|
||||
eprintln!("Failed to write watch config: {}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user