mirror of
https://github.com/proxmoxer/proxmoxer.git
synced 2026-04-25 07:06:00 +03:00
[GH-ISSUE #139] Two extra bytes in ISO file when uploading via API / Proxmoxer #73
Labels
No labels
backend:https
backend:local
backend:openssh
backend:ssh_paramiko
pull-request
status:ansible-issue
status:help-wanted
status:info-needed
status:proxmox-issue
status:review-needed
type:bug 🐞
type:dependency ⛓️
type:docs 📝
type:enhancement ⏫
type:maintenance 🛠️
type:meta
type:question ❓
type:request ✋
type:testing 🧪
version:1.x
version:latest
version:py2
version:py3
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/proxmoxer#73
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rudolfbyker on GitHub (Apr 5, 2023).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/139
Originally assigned to: @jhollowe on GitHub.
When I upload the same ISO file manually through the GUI and through the code below, I get two slightly different results:
0x0d0a(\r\n), and it's seen as a corrupt ISO file.My uploading code:
Hex dump of the first kilobyte:
Note the two byte difference:
The one on my local machine is also 550912 bytes, as expected.
@rudolfbyker commented on GitHub (Apr 6, 2023):
A few comments after I did some debugging:
I followed the instructions at https://proxmoxer.github.io/docs/1.2/examples/files/#uploading-files-to-pve to write the code above. I find it very strange that a file object should be passed to an argument called
filename. I also find it very strange that the API docs https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/storage/{storage}/upload havefilenamebut nothing likefileordata. Maybe these two peculiarities are related?With my code sample, the Request object is being created with
files={'filename': ('foo.iso', <_io.BufferedReader name='foo.iso'>)}atgithub.com/proxmoxer/proxmoxer@cdcb40da0d/proxmoxer/backends/https.py (L229). Is this correct? The API docs of therequestpackage seem to indicate that this should look likefiles={'foo.iso': <_io.BufferedReader name='foo.iso'>}instead.I found this smoking gun:
I would normally expect
\r\nto be a Windows-only thing, but I'm getting the same results when running this in Windows and in a python-alpine Docker container on a Linux host. I have heard that the HTTP spec requires\r\nbut have not confirmed this for myself yet. I usually don't bother with low-level stuff like that.@rudolfbyker commented on GitHub (Apr 6, 2023):
I'm having the same issue when uploading from the command line. So maybe this isn't an issue with
proxmoxerafter all.I would love to hear if anyone else has had this issue, but I'm guessing that the appropriate place for discussion is at https://forum.proxmox.com/threads/two-extra-bytes-in-iso-file-when-uploading-via-api-proxmoxer.125411 rather than here.
@jhollowe commented on GitHub (Apr 6, 2023):
What version of PVE, proxmoxer, and Python are you using?
There have been some issues with file upload that I recently found and got merged into PVE's API server. I would suggest updating to the latest PVE and installing the
developbranch of proxmoxer and try using theproxmoxer.tools.files's .This will calculate a checksum from the local file and then get PVE to validate that.
@jhollowe commented on GitHub (Apr 6, 2023):
I would imagine that the issue is related to the
Content-Typeon the file's multipart. Thedevelopbranch now adds this to its uploads as it seems PVE isn't following RFC 2388 which specifies theContent-Typeas optional.See #116 for previous errors concerning this regression.
@rudolfbyker commented on GitHub (Apr 6, 2023):
My versions:
I'll try the latest proxmoxer in a moment…
@rudolfbyker commented on GitHub (Apr 17, 2023):
This has been resolved in Proxmox itself: Just use
aptto updatelibpve-http-server-perlto anything>= 4.2-2. Details: https://forum.proxmox.com/threads/two-extra-bytes-in-iso-file-when-uploading-via-api-proxmoxer.125411/post-548156