Skip to content

Commit

Permalink
Add filename to blob on formdata append
Browse files Browse the repository at this point in the history
  • Loading branch information
hdiniz committed Feb 24, 2025
1 parent a1ac1ed commit 4feed26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/apollo-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ function createLink({ twoFactorAuthContext, accessToken = null }) {
fetch: linkFetch,
headers: { ...httpHeaders, 'Apollo-Require-Preflight': 'true' },
formDataAppendFile(formData, fieldName, file) {
formData.append(fieldName, new Blob([file as File], { type: file.type }));
formData.append(fieldName, new Blob([file as File], { type: file.type }), (file as File).name);
},
});
const apiV2DefaultLink = createUploadLink({
uri: getGraphqlUrl('v2'),
fetch: linkFetch,
headers: { ...httpHeaders, 'Apollo-Require-Preflight': 'true' },
formDataAppendFile(formData, fieldName, file) {
formData.append(fieldName, new Blob([file as File], { type: file.type }));
formData.append(fieldName, new Blob([file as File], { type: file.type }), (file as File).name);
},
});

Expand Down

0 comments on commit 4feed26

Please sign in to comment.