Skip to content

Commit ea3a242

Browse files
committed
fix: use 422 instead of 500 for metadata access failures
Use 422 Unprocessable Entity instead of 500 Internal Server Error for metadata access failures, as it's more semantically correct. The file exists and path is valid, but can't be processed due to metadata access issues (permissions, locks, etc.).
1 parent 009341e commit ea3a242

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/tauri/src/protocol/asset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn get_response(
5757
// Check if we have read permissions
5858
if let Err(e) = std::fs::metadata(&path) {
5959
log::error!("Failed to get metadata for {}: {}", path, e);
60-
return resp.status(500).body(format!("Failed to access file metadata: {}", e).into_bytes().into()).map_err(Into::into);
60+
return resp.status(422).body(format!("Failed to access file metadata: {}", e).into_bytes().into()).map_err(Into::into);
6161
}
6262

6363
let (mut file, len, mime_type, read_bytes) = crate::async_runtime::safe_block_on(async move {

0 commit comments

Comments
 (0)