Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.32.0

Bug #11502 Uploading patch doesn't work
Submitted: 2007-07-02 10:10 UTC
From: rudis Assigned: cellog
Status: Closed Package: pearweb (version 1.16.1)
PHP Version: Irrelevant OS: Mac OS X 10.4
Roadmaps: 1.17.0    
Subscription  


 [2007-07-02 10:10 UTC] rudis (Simon Ruderich)
Description: ------------ Hi, today I tried to upload a patch for the bug http:// pear.php.net/bugs/bug.php?id=11500 but it didn't work at first. I entered "package.diff" as patch name and selected my file (also named "package.diff"). After pressing "Save" I got the following error: Error: uploaded patch file must be text file (save as e.g. "patch.txt" or "package.diff") Could not attach patch "package.diff" to Bug #11500 I stored the patch on my server so you can look at it: http://ruderich.com/pear_tree_patch.diff I also stored the request data of my browser (Safari on Mac OS X 10.4): http://ruderich.com/pear_request.txt It looks like Safari is sending the patch as application/ octet-stream and not as text. I don't know why. But attaching such a patch should still work. After that I used a different extension for my file "package.txt" and now it worked. Maybe the test for the patchfile can be modified so it doesn't look at the content-type (which can be forged anyway) but only at the content. Maybe a preg_match which ensures only normal characters are used. Thanks for your help, Simon

Comments

 [2007-07-03 00:02 UTC] cellog (Greg Beaver)
if safari is too stupid to use a text-based mime type for text, there is nothing we can do about it. Use a better browser.
 [2007-07-03 14:51 UTC] rudis (Simon Ruderich)
I can understand that. But could you at least add a simple message which tells the user if the upload does not work he/ she should use a .txt-extension. Maybe at the error page. This would help to prevent the problem, because I was confused at the beginning why the upload didn't work. Thanks for your help, Simon
 [2007-07-15 21:21 UTC] floele (Florian Schmitz)
I've had a similar problem with Firefox, both diff and txt. I had to use IE to upload my file. Don't suggest me to switch from Firefox to IE just for this website please.
 [2007-07-16 07:38 UTC] crodriguez (Cristian Rodriguez)
Peraphs the pear server needs fileinfo installed and detect the mime-type of the file in server side instead of the "curious" behaviuor of relying in what the browser sends ( which is a piece of cake to fake btw....)
 [2007-07-25 20:22 UTC] davidc (David Coallier)
In this case, I am sorry to say but the file type is application/octet-stream. The reason for this is simple. Try to wget your file then type: file -bi pear_tree_patch.diff Let me know what is the output you get of that command. Thanks,
 [2007-08-28 16:49 UTC] rudis (Simon Ruderich)
Sorry, for the late reply, kind of forgot about this bug. After a download I get this: text/x-c++; charset=us-ascii For a normal patch created on my computer I get this: text/plain; charset=us-ascii So there could be a problem. But I think it would be the simplest just to modify the error message (if this hasn't already happened), so the user knows he/she should use a txt extension and try again. Thanks, Simon
 [2007-09-23 23:20 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.