Bug 374442 - Exporting images with line breaks in their captions to flickr fails
Summary: Exporting images with line breaks in their captions to flickr fails
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-WebService-Flickr (show other bugs)
Version: 5.6.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-01 23:02 UTC by Richard Ash
Modified: 2018-01-30 21:23 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.4.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Ash 2017-01-01 23:02:44 UTC
I can export images from Digikam 5.3.0 to flickr without issue if they have no caption (used for the Flickr description field), or if they have a caption which consists of a single line of text.

However if I have a line break in the caption (typed by pressing enter in the caption field) then the upload always fails with the "Invalid signature" error code from Flickr.

Also reproduced with a build of 5.4.0 from git.

I did some debugging and testing:
* Digikam presents the caption to the plugin as a plain text QString with the line break represented by a line feed character (0xOA).
* Flickr's API documentation for the description just says "A description of the photo. May contain some limited HTML." with no detail on what the limits are. https://www.flickr.com/services/api/upload.api.html

I tried a few different things to see if I could hit on a solution:
* If the newline character is stripped out, then the upload succeeds (so nothing else is wrong).
* If the newline is replaced by a CRLF pair, then the same error occurs
* If the newline is replaced by a CR (only) then the same error occurs
* If the newline is replaced by the HTML <br> tag then the upload succeeds (signature must be OK), but the <br> tag is removed, resulting in a one-line caption with the words either side of the break run together.

My suspicion (but I can't prove it) is that the description text is getting altered before the server-side signature check, which means it doesn't pass - but without knowing what to, we can't get the right signature!
Comment 1 Richard Ash 2017-01-01 23:12:55 UTC
Flickr discussion topic on the "how do we get new lines" question here:
https://www.flickr.com/groups/api/discuss/72157674855445343/
Comment 2 Maik Qualmann 2017-01-03 18:44:57 UTC
Git commit d012c2c2032b489f17d6caafedaa721264a52f74 by Maik Qualmann.
Committed on 03/01/2017 at 18:44.
Pushed by mqualmann into branch 'master'.

fix upload problem in Flickr tool if line feeds in title or description exist

M  +12   -4    flickr/flickrtalker.cpp

https://commits.kde.org/kipi-plugins/d012c2c2032b489f17d6caafedaa721264a52f74
Comment 3 Maik Qualmann 2017-01-03 18:48:13 UTC
I see this commit as workaround. We had Flickr users with upload problems, it could be related to this problem. Line feeds are replaced with spaces.

Maik
Comment 4 Richard Ash 2017-01-03 20:45:46 UTC
I wondered if this was responsible for other people's issues. I've been using the line-feed substitution as a work-around. Can confirm that the fix in Git works for me.

What is annoying is that in 4.4.0 this worked fine, but I can't see any relevant difference in the code, except that 4.4.0 used kurl instead of QUrl and wasn't (I don't think) working in UTF-8.
Comment 5 Maik Qualmann 2017-01-04 22:28:27 UTC
Git commit cb4fdcfa7788744a0616fcb2720e059b751ca3ae by Maik Qualmann.
Committed on 04/01/2017 at 22:26.
Pushed by mqualmann into branch 'master'.

fix signature calculation from the Flickr tool
Related: bug 374510
FIXED-IN: 5.4.0

M  +2    -1    NEWS
M  +9    -30   flickr/flickrtalker.cpp

https://commits.kde.org/kipi-plugins/cb4fdcfa7788744a0616fcb2720e059b751ca3ae
Comment 6 Richard Ash 2017-01-21 16:13:28 UTC
Confirmed fixed in 5.4.0