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

Unsupported Media Type for Patching file #11335

Closed
3 tasks done
kuzmi4 opened this issue Jan 29, 2022 · 4 comments · Fixed by #11347
Closed
3 tasks done

Unsupported Media Type for Patching file #11335

kuzmi4 opened this issue Jan 29, 2022 · 4 comments · Fixed by #11347
Labels

Comments

@kuzmi4
Copy link

kuzmi4 commented Jan 29, 2022

Preflight Checklist

Describe the Bug

For updating FILE can be used json, and multiform mediatypes (https://docs.directus.io/reference/files/#update-a-file)

At now you recieve reject when send application/json mediatype data for PATCH /files/:id
2022-01-29 110108

To Reproduce

Send request for update direactus file data (title, tags, etc...) in application/json mediatype

Errors Shown

{
"errors": [
{
"message": "Unsupported Content-Type header",
"extensions": {
"code": "UNSUPPORTED_MEDIA_TYPE"
}
}
]
}

What version of Directus are you using?

9.5.0

What version of Node.js are you using?

17.4.0

What database are you using?

Postgres 13

What browser are you using?

Firefox

What operating system are you using?

Linux 5.4.0-42-generic

How are you deploying Directus?

Kubernetes

@Prochy20
Copy link

I can cofirm I have the same issue in my instance.

@paescuj
Copy link
Member

paescuj commented Jan 29, 2022

Do you want to replace the file itself or just the metadata? How does your request look like?

From the docs:

You can either submit a JSON object consisting of a partial file object to update the file meta, or send a multipart/form-data request to replace the file contents on disk.

@kuzmi4
Copy link
Author

kuzmi4 commented Jan 29, 2022

I send json via application/json for update metadata.
(For update file data i use multiform)

Olso need change OAS file for add information about multiform type

изображение

@jeremybradbury
Copy link

jeremybradbury commented Jan 29, 2022

I was able to duplicate this issue in a different way. I uploaded an image to attach it to an object in a collection, using the admin UI.

Context: CMS nerd but Directus n00b, just learning all the things, before I get to API internals & GraphQL.

Later when I tried to rename the title using file editor in the admin UI, it gave this same error.

same-error

We cannot edit titles, filenames or add descriptions/tags to any images. For reference, this was a .jpg file that renders nicely.

9.5.0 as well, Postgres 13 as well, Node v16 (Windows 10) locally. yuk IK but I do server development with windows gaming. running node v14, Ubuntu 20 & PG 10 on the server.

LMK if there's more I can do to help than just raise my hand & say: this is a bigger/broader problem than it may seem.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants