Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3402382
D8372.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8372.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8372: [lib] Add util functions to get blob URI
Attached
Detach File
Event Timeline
Log In to Comment