Page MenuHomePhabricator

D9943.diff
No OneTemporary

D9943.diff

diff --git a/keyserver/src/services/blob.js b/keyserver/src/services/blob.js
--- a/keyserver/src/services/blob.js
+++ b/keyserver/src/services/blob.js
@@ -61,7 +61,15 @@
}
}
-async function download(hash: string): Promise<Blob> {
+async function download(hash: string): Promise<
+ | {
+ +found: false,
+ }
+ | {
+ +found: true,
+ +blob: Blob,
+ },
+> {
const url = getBlobFetchableURL(hash);
const response = await fetch(url, {
method: blobService.httpEndpoints.GET_BLOB.method,
@@ -69,7 +77,12 @@
'content-type': 'application/json',
},
});
- return response.blob();
+
+ if (!response.ok) {
+ return { found: false };
+ }
+ const blob = await response.blob();
+ return { found: true, blob };
}
export { upload, uploadBlob, assignHolder, download };

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 5:16 PM (18 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591131
Default Alt Text
D9943.diff (817 B)

Event Timeline