Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/bin/signedshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,27 @@ fn validate_command(sidecar_path: &Path, media_path: &Path, json_output: bool) -
s
}
Err(e) => {
let err_msg = format!("{}", e);
if err_msg.contains("valid UTF-8") || err_msg.contains("expected value") {
let ext = sidecar_path
.extension()
.and_then(|e| e.to_str())
.unwrap_or("");
if matches!(
ext,
"jpg" | "jpeg" | "png" | "heic" | "heif" | "mp4" | "mov"
) {
eprintln!(
"[FAILED] The sidecar path appears to be a media file, not a JSON sidecar."
);
eprintln!(" Did you swap the arguments?");
eprintln!(" Usage: signedshot validate <sidecar.json> <media>");
return Err(anyhow::anyhow!(
"Arguments appear to be swapped: sidecar path '{}' looks like a media file",
sidecar_path.display()
));
}
}
println!("[FAILED] Sidecar parsing: {}", e);
return Err(e).context("Failed to parse sidecar");
}
Expand Down