Skip to content

Commit

Permalink
Merge pull request #4283 from owid/cf-images-fixes
Browse files Browse the repository at this point in the history
🐛 Use guid for cloudflare image uploads
  • Loading branch information
ikesau authored Dec 11, 2024
2 parents db3e296 + 9a71cca commit db5369a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions adminSiteServer/imagesHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export async function processImageContent(
export async function uploadToCloudflare(filename: string, blob: Blob) {
const body = new FormData()
body.append("file", blob, filename)
body.append("id", encodeURIComponent(filename))
body.append("metadata", JSON.stringify({ filename }))
body.append("requireSignedURLs", "false")

Expand Down Expand Up @@ -91,9 +90,9 @@ export async function uploadToCloudflare(filename: string, blob: Blob) {

export async function deleteFromCloudflare(cloudflareId: string) {
const response = await fetch(
`https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_IMAGES_ACCOUNT_ID}/images/v1/${encodeURIComponent(
`https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_IMAGES_ACCOUNT_ID}/images/v1/${
cloudflareId
)}`,
}`,
{
method: "DELETE",
headers: {
Expand Down

0 comments on commit db5369a

Please sign in to comment.