Package: choqok
Version: 1.5-4~bpo8+1
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

In the current version, I could not send image files to my twitter account. Debugging information was hard to get, but through strace I managed to extract the following from the twitter api after the POST with the image was sent:

{"errors":[{"code":195,"message":"Missing or invalid url parameter."}]}

Googling lead to posts like this one stating issues with the send form:

https://twittercommunity.com/t/statuses-update-with-media-getting-missing-or-invalid-url-parameter/11832

Upstream had a commit that looked like a fix:

https://quickgit.kde.org/?p=choqok.git&a=commit&h=d01ab86b251329035648056c9c7d0918364494a3

But after researching, it appears that that commit is just an update to use the QT5 specific methods.

After looking at online examples and tracing an actual image post to my twitter account, I devised the attached patch that modifies the form declarations. I built a new deb and installed it. I tested with many image formats (png, jpg), and with many different sizes (1kb-1.2mb), and they all posted to my twitter account fine.

I compared the source files between the currently installed debian version and the upstream 1.6 version. I did not see any difference in how the form was handled so I don't know if upstream is still effected or not, and I have no way to test 1.6 as I don't have QT5 libs at the moment.

Regards,
Samuel Smith


--- System information. ---
Architecture: amd64
Kernel:       Linux 3.16.0-4-amd64

Debian Release: 8.6




Index: choqok-1.5/libchoqok/mediamanager.cpp
===================================================================
--- choqok-1.5.orig/libchoqok/mediamanager.cpp
+++ choqok-1.5/libchoqok/mediamanager.cpp
@@ -204,7 +204,7 @@ QByteArray MediaManager::createMultipart
     QString formHeader( newLine + "Content-Disposition: form-data; name=\"%1\"" );
     QByteArray header("--AaB03x");
     QByteArray footer("--AaB03x--");
-    QString fileHeader(newLine + "Content-Disposition: file; name=\"%1\"; filename=\"%2\"");
+    QString fileHeader(newLine + "Content-Disposition: form-data; name=\"%1\"; filename=\"%2\"");
     QByteArray data;
 
     data.append(header);
@@ -214,7 +214,7 @@ QByteArray MediaManager::createMultipart
         QList< QMap< QString, QByteArray > >::const_iterator endIt1 = mediaFiles.constEnd();
         for(; it1!=endIt1; ++it1){
             data.append( fileHeader.arg(it1->value("name").data()).arg(it1->value("filename").data()).toUtf8() );
-            data.append(newLine + "Content-Type: " + it1->value("mediumType"));
+            data.append(newLine + "Content-Type: application/octet-stream");
             data.append(newLine);
             data.append(newLine + it1->value("medium"));
         }

Reply via email to