Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33023886
D14636.1768391679.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D14636.1768391679.diff
View Options
diff --git a/native/media/image-utils.js b/native/media/image-utils.js
--- a/native/media/image-utils.js
+++ b/native/media/image-utils.js
@@ -21,11 +21,12 @@
+orientation: ?number,
};
type ProcessImageResponse = {
- success: true,
- uri: string,
- mime: string,
- dimensions: Dimensions,
- thumbHash: ?string,
+ +success: true,
+ +uri: string,
+ +mime: string,
+ +dimensions: Dimensions,
+ +thumbHash: ?string,
+ +shouldDisposePath: ?string,
};
async function processImage(input: ProcessImageInfo): Promise<{
steps: $ReadOnlyArray<MediaMissionStep>,
@@ -47,7 +48,14 @@
const { thumbHash } = thumbhashStep;
return {
steps,
- result: { success: true, uri, dimensions, mime, thumbHash },
+ result: {
+ success: true,
+ uri,
+ dimensions,
+ mime,
+ thumbHash,
+ shouldDisposePath: null,
+ },
};
}
const { targetMIME, compressionRatio, fitInside } = plan;
@@ -69,7 +77,8 @@
const saveConfig = { format, compress: compressionRatio };
let success = false,
- exceptionMessage;
+ exceptionMessage,
+ shouldDisposePath;
const start = Date.now();
try {
const result = await ImageManipulator.manipulateAsync(
@@ -81,6 +90,7 @@
uri = result.uri;
mime = targetMIME;
dimensions = { width: result.width, height: result.height };
+ shouldDisposePath = result.uri;
} catch (e) {
exceptionMessage = getMessageForException(e);
}
@@ -112,7 +122,14 @@
return {
steps,
- result: { success: true, uri, dimensions, mime, thumbHash },
+ result: {
+ success: true,
+ uri,
+ dimensions,
+ mime,
+ thumbHash,
+ shouldDisposePath,
+ },
};
}
diff --git a/native/media/media-utils.js b/native/media/media-utils.js
--- a/native/media/media-utils.js
+++ b/native/media/media-utils.js
@@ -94,7 +94,8 @@
mime = null,
loop = false,
resultReturned = false,
- thumbHash = null;
+ thumbHash = null,
+ shouldDisposePath = null;
const returnResult = (failure?: MediaMissionFailure) => {
invariant(
!resultReturned,
@@ -109,8 +110,6 @@
uploadURI && mime && mediaType,
'missing required fields in returnResult',
);
- const shouldDisposePath =
- selection.uri !== uploadURI ? pathFromURI(uploadURI) : null;
const filename = sanitizeFilename(selection.filename, mime);
if (mediaType === 'video') {
invariant(uploadThumbnailURI, 'video should have uploadThumbnailURI');
@@ -221,6 +220,7 @@
dimensions,
loop,
thumbHash,
+ shouldDisposePath,
} = videoResult);
} else if (mediaType === 'photo') {
const { steps: imageSteps, result: imageResult } = await processImage({
@@ -240,7 +240,13 @@
if (!imageResult.success) {
return await finish(imageResult);
}
- ({ uri: uriAfterProcessing, mime, dimensions, thumbHash } = imageResult);
+ ({
+ uri: uriAfterProcessing,
+ mime,
+ dimensions,
+ thumbHash,
+ shouldDisposePath,
+ } = imageResult);
} else {
invariant(false, `unknown mediaType ${mediaType}`);
}
diff --git a/native/media/video-utils.js b/native/media/video-utils.js
--- a/native/media/video-utils.js
+++ b/native/media/video-utils.js
@@ -53,6 +53,7 @@
+dimensions: Dimensions,
+loop: boolean,
+thumbHash: ?string,
+ +shouldDisposePath: ?string,
};
async function processVideo(
input: ProcessVideoInfo,
@@ -113,6 +114,7 @@
mime: 'video/mp4',
dimensions: input.dimensions,
loop: false,
+ shouldDisposePath: null,
},
};
}
@@ -169,16 +171,18 @@
const thumbhashStep = await generateThumbhashStep(thumbnailURI);
steps.push(thumbhashStep);
const { thumbHash } = thumbhashStep;
+ const uri = `file://${plan.outputPath}`;
return {
steps,
result: {
success: true,
- uri: `file://${plan.outputPath}`,
+ uri,
thumbnailURI,
thumbHash,
mime: 'video/mp4',
dimensions,
loop,
+ shouldDisposePath: uri,
},
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 11:54 AM (1 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5931197
Default Alt Text
D14636.1768391679.diff (4 KB)
Attached To
Mode
D14636: [native] Fix processed files disposing
Attached
Detach File
Event Timeline
Log In to Comment