-
Notifications
You must be signed in to change notification settings - Fork 16
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
Request header content-type
should be application/x-bittorrent
#483
Comments
Hi @JanGross thank you for opening the issue. I've just tried with both Chrome and Firefox and I can't reproduce the problem. The uploaded torrent: https://index.torrust-demo.com/torrent/2b66980093bc11806fab50cb3cb41835b95a0362/debian The torrent I've used: debian-12.5.0-amd64-netinst.iso.zip
For some reason your browser is using This is what I send using my browser:
Anyway, I guess I think we could accept also that generic binary mime type here. I will change it so you can try it. I guess it's not a problem to accept also that type because it will fail later if it can't parse the torrent file. Have you tried with a different torrent file? I would like to confirm that the problem is the browser version (or something else) but not the torrent file you are using. |
Seems like I need to do some further debugging on my end... Very weird. 🤔 I'll take a closer look at my other machine tomorrow to see if I can figure out what's causing the different headers. https://gist.github.com/JanGross/3b86e154b2df109354beb4478b0b8861 |
Hi @JanGross I'm trying to find out why. This is a ChatGPT response: The variation in MIME type (
To ensure consistency, if you have control over the client-side implementation, you might want to explicitly set the MIME type to the desired value when performing the file upload. Anyway, as I said I think there is no problem with accepting also the type |
I figured it out. Sorry for the confusion and thanks for the support👍🏼 |
@JanGross cool! I'm going to add the other type anyway because I think other people could have the same problem. |
… header Content-Type 8a97b5b feat: [#483] allow upload torrent with application/octet-stream (Jose Celano) Pull request description: Relates to: torrust/torrust-index-gui#483 Some users are having problems uploading torrents becuase the client (browser or other clients) use the HTTP header Contetnt-Type: `application/octet-stream` instead of: `application/x-bittorrent` It seems that the reason is they don't have any application associated to that extension. So it uses the generic binary file mime type. The MIME type can be inferred from the file extension. If the system or application uploading the file has a specific association for .torrent files, it might set the MIME type to application/x-bittorrent. In the absence of such an association, it might fall back to the generic application/octet-stream. ACKs for top commit: josecelano: ACK 8a97b5b Tree-SHA512: 05dedfb1bcff5171a5b8b175887735d4833a6044e201938ff83cd9796d9d8e079dc16665dc2789b7ba5459fe3a49552a800f4c8d2f9e1f14df56fecc41a6fb92
Closed via torrust/torrust-index#491 |
When trying to upload a new torrent, the request gets sent as content-type
multipart/form-data
and thus the API throwsI tried using both Chrome and Firefox against the demo instance.
Request headers for reference (some parts omitted):
Request body for reference
As a test file I used the amd64 Debian CD ISO .torrent from https://www.debian.org/CD/torrent-cd/
The text was updated successfully, but these errors were encountered: