-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Files (stl/gcode) corrupted on upload #680
Comments
Hi @CapnBry, It looks like there is some information missing from your ticket that will be needed in order to process it properly. Please take a look at the Contribution Guidelines and the page How to file a bug report on the project wiki, which will tell you exactly what your ticket has to contain in order to be processable. If you did not intend to report a bug, please take special note of the title format to use as described in the Contribution Guidelines. I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2014-12-29 15:30) I'll close this ticket so it doesn't clutter the bug tracker. Best regards, PS: I'm just an automated script, not a human being. |
I love cookies. I truly do.
|
<3 That's an awesome bug report! Will take a closer look. To be honest, I'm always scared of fumbling around with that stuff. Remember that horrible Heisenbug that you unearthed and I hunted down and killed back in August? That was also there... |
I do remember! I never would have found that bug. This is wicked straight-forward as far as reproducing goes. Just hexdump a file before upload and after and you'll see it has the extra \r\n on it. It makes sense looking at the code too, it reads everything to the mime barrier but it is always preceded by \r\n which the code doesn't remove so whatever the German equivalent of "Bob's your uncle" is. I was just concerned about the rebuilding of the message now without the extra line delimiters maybe affecting other code where you've come to expect it there. I've been using it all week and have played around changing settings (which would also be POSTed right?) and it all seems to be ok. You know your internals better than I do though. Sometimes I can't figure out how some bit of code magically runs out of nowhere by design. Because: FUS RO...CTOPRINT! |
There was still an issue when writing the body back in case of file uploads which caused the included form parameters to not be written out correctly (because here suddenly a So big thanks for spotting this! Now the md5sums of uploaded files match their original ones too :D |
Freakin' sweet. See I knew you'd find that my quick fix broke something else. We're the best team, something is broken, I break something else, you fix them both. TEAMWORK |
One day we really need to have a drink together to celebrate this ;) |
I was having a problem with binary STL files not wanting to be sliced by Slic3r because "File size mismatch". I looked at the uploaded STL file and sure enough it had two extra bytes on the end of it
\r\n
.I started digging in and all files which I've uploaded using the relatively new "temp upload file rename" tornado server code have extra
\r\n
at the end of them. This isn't a problem with gcode files or text STL files because the extra data is just ignored.I tracked this down to
src/octoprint/server/util/tornado.py:UploadStorageFallbackHandler
. What's happening is it is looking for the multipart delimiter and applying everything between the delimiters as "data". However, mime states that the boundary has to start on a new line so the actual data is appended by the sender with\r\n
then the multipart boundary on the next line. This is true for all content types and looks like this:The code in the tornado handler looks for the boundary and splits the data off properly but doesn't remove the newline at the end. The file will contain the delimiter which is actually the start of the mime boundary. The simple fix is this
But you need to make sure that the request bodies are being rebuilt properly for other multipart types (which I believe have extra
\r\n
in them currently). I think they are but I am sure you have a better way of looking than mine, which is to print() data to the console. I am so bad at Python I should be ashamed.The text was updated successfully, but these errors were encountered: