Page MenuHomePhabricator

D10852.id.diff
No OneTemporary

D10852.id.diff

diff --git a/native/media/encryption-utils.js b/native/media/encryption-utils.js
--- a/native/media/encryption-utils.js
+++ b/native/media/encryption-utils.js
@@ -289,7 +289,10 @@
async function decryptMedia(
blobURI: string,
encryptionKey: string,
- options: { +destination: 'file' | 'data_uri' },
+ options: {
+ +destination: 'file' | 'data_uri',
+ +destinationDirectory?: string,
+ },
): Promise<{
steps: $ReadOnlyArray<DecryptFileStep>,
result: DecryptionFailure | { success: true, uri: string },
@@ -378,7 +381,8 @@
// blobURI is a URL, we use the last part of the path as the filename
const uriSuffix = blobURI.substring(blobURI.lastIndexOf('/') + 1);
const filename = readableFilename(uriSuffix, mime) || uriSuffix;
- const targetPath = `${temporaryDirectoryPath}${Date.now()}-${filename}`;
+ const directory = options.destinationDirectory ?? temporaryDirectoryPath;
+ const targetPath = `${directory}${Date.now()}-${filename}`;
try {
await commUtilsModule.writeBufferToFile(targetPath, decryptedData.buffer);
} catch (e) {

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 13, 12:57 PM (8 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3328524
Default Alt Text
D10852.id.diff (1 KB)

Event Timeline