fix(mobile): use originalFileName for multipart filename in background uploads
The iOS background upload path set the multipart file part `filename` to the PhotoKit temp export basename (e.g. `0EAAEF1B-...-_o_IMG_9237.MOV`) while the foreground path and the `filename` form field both use the clean `originalFileName` (e.g. `IMG_9237.MOV`). This made the same asset appear as two different uploads in raw HTTP/access logs and broke reverse proxies / upload optimizers that use the multipart filename as part of a dedup key. Set the multipart filename to `originalFileName ?? filename` so both upload paths and the form field agree. Covers regular and live-photo uploads since both route through `buildUploadTask`. Closes #28601pull/28698/head
parent
c42cea5ca9
commit
557eac566e
|
|
@ -422,7 +422,7 @@ class BackgroundUploadService {
|
|||
httpRequestMethod: 'POST',
|
||||
url: url,
|
||||
headers: headers,
|
||||
filename: filename,
|
||||
filename: originalFileName ?? filename,
|
||||
fields: fieldsMap,
|
||||
baseDirectory: baseDirectory,
|
||||
directory: directory,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ void main() {
|
|||
|
||||
expect(task, isNotNull);
|
||||
expect(task!.fields['filename'], equals('OriginalPhoto.jpg'));
|
||||
// multipart file part filename must match the clean originalFileName (foreground/background parity)
|
||||
expect(task.filename, equals('OriginalPhoto.jpg'));
|
||||
verify(() => mockAssetMediaRepository.getOriginalFilename(asset.id)).called(1);
|
||||
});
|
||||
|
||||
|
|
@ -118,6 +120,7 @@ void main() {
|
|||
expect(task, isNotNull);
|
||||
// For live photos, extension should be changed to match the video file
|
||||
expect(task!.fields['filename'], equals('OriginalLivePhoto.mov'));
|
||||
expect(task.filename, equals('OriginalLivePhoto.mov'));
|
||||
verify(() => mockAssetMediaRepository.getOriginalFilename(asset.id)).called(1);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue