refactor(mobile): address code review feedback
Extract APP_SCHEME_PREFIX constant for the custom URL scheme string, and derive the photo library fallback filename extension from the asset's MIME type instead of always using .jpg. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -180,7 +180,9 @@ export default function UploadScreen() {
|
||||
|
||||
if (!result.canceled && result.assets.length > 0) {
|
||||
const asset = result.assets[0];
|
||||
const filename = asset.fileName ?? `photo_${Date.now()}.jpg`;
|
||||
// Derive extension from MIME type so the filename matches the actual format
|
||||
const ext = asset.mimeType?.split("/")[1]?.replace("jpeg", "jpg") ?? "jpg";
|
||||
const filename = asset.fileName ?? `photo_${Date.now()}.${ext}`;
|
||||
await uploadFile(asset.uri, filename, asset.mimeType ?? "image/jpeg");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user