Page MenuHomePhabricator

D8372.diff
No OneTemporary

D8372.diff

diff --git a/lib/media/media-utils.js b/lib/media/media-utils.js
--- a/lib/media/media-utils.js
+++ b/lib/media/media-utils.js
@@ -2,7 +2,11 @@
import invariant from 'invariant';
-import type { Media } from '../types/media-types.js';
+import type {
+ EncryptedImage,
+ EncryptedVideo,
+ Media,
+} from '../types/media-types.js';
import type {
MultimediaMessageInfo,
RawMultimediaMessageInfo,
@@ -79,6 +83,24 @@
return `${localUploadPrefix}${nextLocalUploadID++}`;
}
+/**
+ * Returns effective multimedia blob URI for encrypted image or video
+ */
+function encryptedMediaBlobURI(media: EncryptedImage | EncryptedVideo): string {
+ const uri = media.blobURI ?? media.holder;
+ invariant(uri, 'encrypted media has no blob URI');
+ return uri;
+}
+
+/**
+ * Returns effective thumbnail blob URI for encrypted video
+ */
+function encryptedVideoThumbnailBlobURI(media: EncryptedVideo): string {
+ const uri = media.thumbnailBlobURI ?? media.thumbnailHolder;
+ invariant(uri, 'encrypted thumbnail has no blob URI');
+ return uri;
+}
+
export {
maxDimensions,
contentStringForMediaArray,
@@ -87,4 +109,6 @@
isMediaBlobServiceHosted,
getNextLocalUploadID,
fetchableMediaURI,
+ encryptedMediaBlobURI,
+ encryptedVideoThumbnailBlobURI,
};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 4:30 PM (4 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2612368
Default Alt Text
D8372.diff (1 KB)

Event Timeline