Skip to content

Commit

Permalink
Merge pull request #4260 from serlo/refactor/remove-tagging
Browse files Browse the repository at this point in the history
refactor(editor): remove upload tagging code
  • Loading branch information
elbotho authored Nov 12, 2024
2 parents bffcf03 + f8a263c commit dba6b09
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/editor/src/plugins/image/utils/upload-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,12 @@ async function uploadFile({
const data = (await result?.json()) as {
signedUrl: string
fileUrl: string
tagging: string
}
if (!data) return Promise.reject('Could not get signed URL')

const { signedUrl, fileUrl, tagging } = data
const { signedUrl, fileUrl } = data

const success = await uploadToBucket({
file,
signedUrl,
tagging,
})
const success = await uploadToBucket({ file, signedUrl })
if (!success) return Promise.reject('Could not upload file')
return Promise.resolve(fileUrl)
}
Expand All @@ -88,19 +83,16 @@ const errorMessage = 'Error while uploading'
async function uploadToBucket({
file,
signedUrl,
tagging,
}: {
file: File
signedUrl: string
tagging: string
}) {
const response = await fetch(signedUrl, {
method: 'PUT',
body: file,
headers: {
'Content-Type': file.type,
'x-amz-tagging': tagging,
'Access-Control-Allow-Origin': '*',
'Content-Type': file.type,
},
}).catch((e) => {
// eslint-disable-next-line no-console
Expand Down

0 comments on commit dba6b09

Please sign in to comment.