Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageDetails API responds with meta and not metadata #1378

Open
2 tasks done
itsdax opened this issue Aug 27, 2023 · 0 comments
Open
2 tasks done

ImageDetails API responds with meta and not metadata #1378

itsdax opened this issue Aug 27, 2023 · 0 comments

Comments

@itsdax
Copy link

itsdax commented Aug 27, 2023

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

v0.75.0

Go environment

v1.20

Expected output

GetImage calls to respond with Metadata on images that contain metadata.

Actual output

No metadata in response.

Code demonstrating the issue

// Upload image with metadata and grab ImageId


img, err := cloudflareApi.GetImage(ctx, cloudflare.AccountIdentifier(b.Store.cloudflareAccountId), imageId)
if err != nil {
  return nil, err
}

fmt.Println(image.Metadata) # This is empty

Steps to reproduce

  1. Upload an image and add metadata to it
  2. Call GetImage
    3.Metadata is always empty from the response

References

This is likely because the API doesn't use metadata as expected from the code here, but instead uses meta. Thus the library does not parse the response value.

I can debug the network requests and confirm that the image does in fact has metadata. The library simply omits it when parsing:

{
  "result": {
    "id": "c2132442-7029-47fa-c62f-1c7d54733501",
    "filename": "<omitted>",
    "meta": { <------- this
      "userId": "<omitted>"
    },
    "uploaded": "2023-08-27T04:20:43.315Z",
    "requireSignedURLs": true,
    "variants": [
      "https://imagedelivery.net/<omitted>/c2132442-7029-47fa-c62f-1c7d54733501/1080",
      "https://imagedelivery.net/<omitted>/c2132442-7029-47fa-c62f-1c7d54733501/public"
    ]
  },
  "success": true,
  "errors": [],
  "messages": []
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant