Bug 84179 - [patch] http upload scrambles png images
Summary: [patch] http upload scrambles png images
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml forms (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR critical
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-28 21:13 UTC by M
Modified: 2004-07-18 15:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test PNG image (20.80 KB, image/png)
2004-06-30 02:19 UTC, Nicolas Goutte
Details

Note You need to log in before you can comment on or make changes to this bug.
Description M 2004-06-28 21:13:30 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

I've just attached 2 png images to a bug and they won't show. Here are the urls:

http://bugs.kde.org/attachment.cgi?id=6498&action=view
http://bugs.kde.org/attachment.cgi?id=6499&action=view

The bug they were attached to is bug #84178

These 2 png files are _not_ corrupt - they show fine on my local filesystem in Konqueror.
Comment 1 Nicolas Goutte 2004-06-30 01:46:03 UTC
Have you tried to download them again and see if there are still the same?

(Mozilla complain that they are corrupt.)

Have a nice day!
Comment 2 Nicolas Goutte 2004-06-30 01:51:42 UTC
pngcheck complains that the file were corrupted:
"... file CORRUPTED by text compression."

(file complains too.)

So please check how you have uploaded the files, if you do not feel having done anything wrong try to upload the file again with Mozilla (or any other browser) to know if the problem is KDE Bugs or Konqueror.

Have a nice day!
Comment 3 Nicolas Goutte 2004-06-30 02:19:23 UTC
Created attachment 6517 [details]
Test PNG image
Comment 4 Nicolas Goutte 2004-06-30 02:24:42 UTC
So I was able to upload and download the file ( attachment #6517 [details] ) with Konqueror 3.1.4-SuSE 9.0 without corruption. (Mozilla 1.4 can download and display this file correctly.)

Have a nice day!
Comment 5 Stephan Binner 2004-07-01 19:55:51 UTC
Experencied the same (broken image upload) with KDE/HEAD recently.
Comment 6 Stephan Binner 2004-07-18 06:53:53 UTC
The patch in http://bugs.kde.org/show_bug.cgi?id=83098#c6 suggests that it's an khtml bug.
Comment 7 Stephan Kulow 2004-07-18 15:55:26 UTC
CVS commit by coolo: 

reverting Waldo's commit (for #83098) for beta2. I've got another fix reviewed
by Dirk and Waldo, but that will need some more testing 
CCMAIL: 84179-done@bugs.kde.org
CCMAIL: 83098@bugs.kde.org


  M +3 -36     html_formimpl.cpp   1.377


--- kdelibs/khtml/html/html_formimpl.cpp  #1.376:1.377
@@ -110,36 +110,4 @@ long HTMLFormElementImpl::length() const
 }
 
-static QCString expandLF(const QCString& s)
-{
-    // LF -> CRLF
-    unsigned crs = s.contains( '\n' );
-    if (crs == 0)
-       return s;
-    unsigned len = s.length();
-
-    QCString r(len + s.contains( '\n') *2 + 1);
-    unsigned pos2 = 0;
-    for(unsigned pos = 0; pos < len; pos++)
-    {
-       char c = s[pos];
-       switch(c)
-       {
-         case '\n':
-           r[pos2++] = '\r';
-           r[pos2++] = '\n';
-           break;
-
-         case '\r':
-           break;
-
-         default:
-           r[pos2++]= c;
-           break;
-       }
-    }
-    r.truncate(pos2);
-    return r;
-}
-
 static QCString encodeCString(const QCString& e)
 {
@@ -318,8 +286,7 @@ QByteArray HTMLFormElementImpl::formData
                     // append body
                     unsigned int old_size = form_data.size();
-                    QCString body = expandLF(*it);
-                    form_data.resize( old_size + hstr.length() + body.size() + 1);
+                    form_data.resize( old_size + hstr.length() + (*it).size() + 1); 
                     memcpy(form_data.data() + old_size, hstr.data(), hstr.length());
-                    memcpy(form_data.data() + old_size + hstr.length(), body.data(), body.size());
+                    memcpy(form_data.data() + old_size + hstr.length(), *it, (*it).size()); 
                     form_data[form_data.size()-2] = '\r';
                     form_data[form_data.size()-1] = '\n';