Page MenuHomePhabricator

D8370.diff
No OneTemporary

D8370.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
@@ -46,7 +46,9 @@
(!!media.uri && isBlobServiceURI(media.uri)) ||
(!!media.holder && isBlobServiceURI(media.holder)) ||
(!!media.thumbnailURI && isBlobServiceURI(media.thumbnailURI)) ||
- (!!media.thumbnailHolder && isBlobServiceURI(media.thumbnailHolder))
+ (!!media.thumbnailHolder && isBlobServiceURI(media.thumbnailHolder)) ||
+ (!!media.blobURI && isBlobServiceURI(media.blobURI)) ||
+ (!!media.thumbnailBlobURI && isBlobServiceURI(media.thumbnailBlobURI))
);
}
diff --git a/lib/types/media-types.js b/lib/types/media-types.js
--- a/lib/types/media-types.js
+++ b/lib/types/media-types.js
@@ -672,25 +672,31 @@
localMediaSelection: t.maybe(nativeMediaSelectionValidator),
});
-export type EncryptedImage = {
+type EncryptedImageCommons = {
+id: string,
- // a media URI for keyserver uploads / blob holder for Blob service uploads
- +holder: string,
+encryptionKey: string,
+type: 'encrypted_photo',
+dimensions: Dimensions,
+thumbHash: ?string,
};
+// old message formats (native codeVersion < FUTURE_CODE_VERSION) used holder
+// new format uses blobURI. Effectively, they both mean blob URI
+export type EncryptedImage =
+ | { ...EncryptedImageCommons, +holder: string }
+ | { ...EncryptedImageCommons, +blobURI: string };
-export const encryptedImageValidator: TInterface<EncryptedImage> =
- tShape<EncryptedImage>({
- id: tID,
- holder: t.String,
- encryptionKey: t.String,
- type: tString('encrypted_photo'),
- dimensions: dimensionsValidator,
- thumbHash: t.maybe(t.String),
- });
+const encryptedImageCommonsValidator = {
+ id: tID,
+ encryptionKey: t.String,
+ type: tString('encrypted_photo'),
+ dimensions: dimensionsValidator,
+ thumbHash: t.maybe(t.String),
+};
+
+const encryptedImageValidator = t.union<EncryptedImage>([
+ tShape({ ...encryptedImageCommonsValidator, holder: t.String }),
+ tShape({ ...encryptedImageCommonsValidator, blobURI: t.String }),
+]);
export type Video = {
+id: string,
@@ -717,33 +723,44 @@
localMediaSelection: t.maybe(nativeMediaSelectionValidator),
});
-export type EncryptedVideo = {
+type EncryptedVideoCommons = {
+id: string,
- // a media URI for keyserver uploads / blob holder for Blob service uploads
- +holder: string,
+encryptionKey: string,
+type: 'encrypted_video',
+dimensions: Dimensions,
+loop?: boolean,
+thumbnailID: string,
- +thumbnailHolder: string,
+thumbnailEncryptionKey: string,
+thumbnailThumbHash: ?string,
};
+// old message formats (native codeVersion < FUTURE_CODE_VERSION) used holder
+// new format uses blobURI. Effectively, they both mean blob URI
+export type EncryptedVideo =
+ | { ...EncryptedVideoCommons, +holder: string, +thumbnailHolder: string }
+ | { ...EncryptedVideoCommons, +blobURI: string, +thumbnailBlobURI: string };
-export const encryptedVideoValidator: TInterface<EncryptedVideo> =
- tShape<EncryptedVideo>({
- id: tID,
+const encryptedVideoCommonsValidator = {
+ id: tID,
+ encryptionKey: t.String,
+ type: tString('encrypted_video'),
+ dimensions: dimensionsValidator,
+ loop: t.maybe(t.Boolean),
+ thumbnailID: tID,
+ thumbnailEncryptionKey: t.String,
+ thumbnailThumbHash: t.maybe(t.String),
+};
+const encryptedVideoValidator = t.union<EncryptedVideo>([
+ tShape({
+ ...encryptedVideoCommonsValidator,
holder: t.String,
- encryptionKey: t.String,
- type: tString('encrypted_video'),
- dimensions: dimensionsValidator,
- loop: t.maybe(t.Boolean),
- thumbnailID: tID,
thumbnailHolder: t.String,
- thumbnailEncryptionKey: t.String,
- thumbnailThumbHash: t.maybe(t.String),
- });
+ }),
+ tShape({
+ ...encryptedVideoCommonsValidator,
+ blobURI: t.String,
+ thumbnailBlobURI: t.String,
+ }),
+]);
export type Media = Image | Video | EncryptedImage | EncryptedVideo;

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 4, 11:00 PM (12 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615070
Default Alt Text
D8370.diff (3 KB)

Event Timeline