Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3374861
D9943.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
817 B
Referenced Files
None
Subscribers
None
D9943.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9943: [keyserver] Check if a blob exists
Attached
Detach File
Event Timeline
Log In to Comment