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

m4a files uploaded in a zip get wrong mimetype #10922

Closed
jo-pol opened this issue Oct 14, 2024 · 4 comments · Fixed by #10923
Closed

m4a files uploaded in a zip get wrong mimetype #10922

jo-pol opened this issue Oct 14, 2024 · 4 comments · Fixed by #10923
Labels
Type: Bug a defect
Milestone

Comments

@jo-pol
Copy link
Contributor

jo-pol commented Oct 14, 2024

What steps does it take to reproduce the issue?

Upload toolsfairy-audio.zip on a dataset page

  • Which page(s) does it occurs on?

dataset page

  • What happens?

The filet gets contentType application/octet-stream

  • To whom does it occur (all users, curators, superusers)?

all

  • What did you expect to happen?

The file should get contentType audio/x-m4a like when uploading the individual files with chrome

Which version of Dataverse are you using?

v. 6.4 build 1609-906f874

Any related open or closed issues to this bug report?

gdcc/dataverse-ansible#375
to show the previewer for the proper content type

Are you thinking about creating a pull request for this issue?
yes

@sbarbosadataverse
Copy link

We tested the zip file included in this issue and are able to duplicate the bug.
The system recognizes the file type once we upload the m4a file by itself.

Screen Shot 2024-10-16 at 4 24 31 PM

@scolapasta
Copy link
Contributor

scolapasta commented Oct 16, 2024

One thing that's strange is when you call the redetect API on both the one from the zipped and the one that was direct:

from zip file:

{"status":"OK","data":{"dryRun":true,"oldContentType":"application/octet-stream","newContentType":"application/octet-stream"}}

from direct:
{"status":"OK","data":{"dryRun":true,"oldContentType":"audio/x-m4a","newContentType":"application/octet-stream"}

which means it would change it to be the same as the one where it didn't detect it... why would that be? and how did it correctly detect it on upload?

@qqmyers
Copy link
Member

qqmyers commented Oct 16, 2024

If the browser supplies a mimetype, we use it if our internal detection only gives application/octet-stream.

@pdurbin
Copy link
Member

pdurbin commented Oct 16, 2024

Right, here's how we document this behavior:

"Please note that it’s possible to “trick” a Dataverse installation into giving a file a content type (MIME type) of your choosing. For example, you can make a text file be treated like a video file with -F '[email protected];type=video/mpeg4', for example. If the Dataverse installation does not properly detect a file type, specifying the content type via API like this a potential workaround."

-- https://guides.dataverse.org/en/6.4/api/native-api.html#add-a-file-to-a-dataset

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

Successfully merging a pull request may close this issue.

5 participants