Skip to content

Commit

Permalink
🐛 use guid for cloudflare image uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesau committed Dec 11, 2024
1 parent db3e296 commit 9a71cca
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 9a71cca

Please sign in to comment.