Unable to upload JSON file

Hello,

I am attempting to upload a JSON file from a new editor to the Media Library, but I am encountering a 500 error.

CURL:

curl 'https://asset-api.prismic.io/assets' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,bs;q=0.7,sr;q=0.6,hr;q=0.5,la;q=0.4' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryRXErZEvwpMChmH7A' \
  -H 'Cookie: ... \
  -H 'Origin: https://element451.prismic.io' \
  -H 'Referer: https://element451.prismic.io/' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
  -H 'repository: element451' \
  -H 'sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'x-prismic-source: Wroom' \
  --data-raw $'------WebKitFormBoundaryRXErZEvwpMChmH7A\r\nContent-Disposition: form-data; name="Communication - Animation JSON.json"; filename="Communication - Animation JSON.json"\r\nContent-Type: application/json\r\n\r\n\r\n------WebKitFormBoundaryRXErZEvwpMChmH7A--\r\n' \
  --compressed

Could you please investigate and let me know what the issue might be?

Thanks,
Sava Lazic

Hi @slazic. I was able to recreate the issue of not being able to upload a JSON file. There are 2 workaround that you can try.

  1. Go to your repo's media library and upload the JSON file from there (https://your-repo-name.prismic.io/medias/). Then you should be able to select the file from the document you want to add it to.
  2. Switch back to the legacy editor and you should be able to upload the JSON file without issue.

I'll let the editor team know about this issue so they can work on a fix for it.

1 Like

Hi @Levi ! Can you confirm that this is a bug of the new Media Library and that will be fixed ? Or does the new Media Library will not accepts JSON in the future.
JSON can be really useful to create and host Lottie animation for example. And a bunch of other stuffs.
!

Capture d'écran 2024-02-27 100653|690x140

Ty for info

I'll let @guy.proops from the Page Builder team comment on this.

Hi @am1 , team is fixing it as we speak. I'll update this thread once it has been done.

Best,
Guy

@am1 you should be able to upload JSON in the Media Library now. Let me know if I can help with anything else.

Best,
Guy

1 Like