Skip to content

Commit

Permalink
[web] Update Blob service DELETE endpoint call
Browse files Browse the repository at this point in the history
Summary:
Depends on D8396

Updated the Blob service DELETE endpoint call on Web to use the new request format.

Test Plan:
Enabled blob service uploads, selected a photo to upload to chat, then deleted it by clicking the "x" button in the photo corner.

The request was successful. Blob service logs:
{F614093}

Reviewers: atul, pklatka

Reviewed By: pklatka

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8397
  • Loading branch information
barthap committed Jul 7, 2023
1 parent e27efd9 commit 8f2e057
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/facts/blob-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const httpEndpoints = Object.freeze({
method: 'PUT',
},
DELETE_BLOB: {
path: '/blob/:holder',
path: '/blob',
method: 'DELETE',
},
});
Expand Down
11 changes: 10 additions & 1 deletion web/input/input-state-container.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import { toBase64URL } from 'lib/utils/base64.js';
import {
makeBlobServiceEndpointURL,
isBlobServiceURI,
blobHashFromBlobServiceURI,
} from 'lib/utils/blob-service.js';
import type { CallServerEndpointOptions } from 'lib/utils/call-server-endpoint.js';
import { getConfig } from 'lib/utils/config.js';
Expand Down Expand Up @@ -1300,8 +1301,16 @@ class InputStateContainer extends React.PureComponent<Props, State> {
);
const endpoint = blobService.httpEndpoints.DELETE_BLOB;
const holder = pendingUpload.blobHolder;
fetch(makeBlobServiceEndpointURL(endpoint, { holder }), {
const blobHash = blobHashFromBlobServiceURI(pendingUpload.uri);
fetch(makeBlobServiceEndpointURL(endpoint), {
method: endpoint.method,
body: JSON.stringify({
holder,
blob_hash: blobHash,
}),
headers: {
'content-type': 'application/json',
},
});
}
}
Expand Down

0 comments on commit 8f2e057

Please sign in to comment.