API call 'save_artifact_file' produces an error, a crash or an unusable .bin file when provided with an image
ajenyon opened this issue · comments
Steps to Reproduce the Problem
- Use the API to obtain an authorisation token (this works just fine):
curl -X POST https://<spacedeck_domain>/sessions -H "Content-Type: application/json" -d '{"email": "<your_email>","password": "<your_password>"}'
- Create an empty artifact, and obtain the artifact ID (this also works, and returns an artifact id, amongst other info):
curl -X POST http://127.0.0.1:9666/api/spaces/<space_id>/artifacts -H "Content-Type: application/json" -H "X-Spacedeck-Auth: <api_token>" -d "{"space_id": "<space_id>","x": 1410,"y": 1257,"w": 320,"h": 170,"r": 0}"
- Attempt to upload a jpeg as a payload into this artifact:
curl -X POST http://127.0.0.1:9666/api/spaces/<space_id>/artifacts/<artifact_id>/payload?filename="testimg.jpg" -H "X-Spacedeck-Auth: <api_token>" -F "file=@C:*******\testimg.jpg;type=image/jpeg"
Expected Behavior
Local image file is uploaded to spacedeck/storage/my_spacedeck_bucket/<artifact_id> as a jpeg, along with generated thumbnails
The image is assigned to the artifact, and is visible when the page is reloaded
Actual Behavior
With the curl command as written:
{"code":1,"signal":null}
With "payload?filename=testimg" (no type):
Docker container crashes, and needs to be restarted
With just "payload":
A .bin file is created in the expected location, rather than an image. It has the same file size as the original jpeg, but doesn't appear in the space as an image, and cannot be opened as one (even if the filetype is changed back to .jpg.
Specifications
Latest version (Dec 2023) running from default docker container under Windows 10