Bug 410692

Summary: Export to google photo: bad request
Product: [Applications] digikam Reporter: jon33040
Component: Plugin-WebService-GoogleAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version First Reported In: 6.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.3.0
Sentry Crash Report:
Attachments: Screenshot showing bad request error.

Description jon33040 2019-08-07 10:49:23 UTC
Created attachment 121995 [details]
Screenshot showing bad request error.

SUMMARY

Sometimes when I put a set of pictures from a trip through my standard workflow, none of them will upload to Google Photos. It doesn't matter which one(s) I pick, either they all upload OK or any combination of them fails with a 'bad request' error. 
I have tried this with DK 6.2.0 on three different computers (two Linux, one Windows). I've tried it with a newly created Google account as well as my regular one. I've tried it with a number of variations on newly created directories from DK, directories previously created by DK (from a trip where the pictures would upload OK) and shared directories created through the Google Photos web interface. I've tried changing the Google user in DK. Nothing makes a difference.

I can upload the same photos manually via the Google Photos web interface.

STEPS TO REPRODUCE
1. Take some pictures
2. Run them through a workflow to create .JPGs
3. Upload the .JPGs to Google Photos

OBSERVED RESULT
Sometimes none of the .JPGs will upload - either individually or as a set.

EXPECTED RESULT
All of the .JPGs upload all the time.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Ubuntu bionic
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
digikam version 6.2.0
CPU cores: 4
Eigen: 3.3.3
Exiv2: 0.27.2
Exiv2 can write to Jp2: Yes
Exiv2 can write to Jpeg: Yes
Exiv2 can write to Pgf: Yes
Exiv2 can write to Png: Yes
Exiv2 can write to Tiff: Yes
Exiv2 supports XMP metadata: Yes
ImageMagick codecs: 6.9.10
KF5: 5.59.0
LensFun: 0.3.95-0
LibCImg: 130
LibJPEG: 80
LibJasper: 1.900.23
LibLCMS: 2080
LibLqr support: Yes
LibPGF: 7.19.03
LibPNG: 1.6.35
LibRaw: 0.19.3
LibTIFF: 4.0.10
Marble: 0.27.20
Parallelized demosaicing: Yes
Qt: 5.11.3
Qt Webkit support: Yes
VKontakte support: No
AkonadiContact support: No
Baloo support: No
Calendar support: Yes
DBus support: No
Database backend: QSQLITE
HTML Gallery support: Yes
LibAVCodec: 57.89.100
LibAVFormat: 57.71.100
LibAVUtil: 55.58.100
LibGphoto2: 2.5.14
LibOpenCV: 3.4.6
LibQtAV: 1.13.0
Media player support: Yes
Panorama support: Yes

I have the log from running DK in the console but I'm not sure if some of the pagetokens could create a security risk if they were included here.
Comment 1 Maik Qualmann 2019-08-07 11:20:11 UTC
I use the Google Plugin relatively often and have not had this problem here with my developer version. Unless an attempt is made to upload to an album with a locked icon. Do you use the AppImage? You can send me the log on the private email. If you re-login in the plugin you should get a new token.

Maik
Comment 2 Maik Qualmann 2019-08-07 11:46:29 UTC
Thank you for the log and the test image. Yes, with this image I can reproduce the error. I'll watch it tonight. My first guess is that it is related to the description, which is very long.

Maik
Comment 3 jon33040 2019-08-07 11:56:58 UTC
(In reply to Maik Qualmann from comment #2)
> Thank you for the log and the test image. Yes, with this image I can
> reproduce the error. I'll watch it tonight. My first guess is that it is
> related to the description, which is very long.
> 
> Maik

I think there are other images in that set with shorter descriptions. I'll double check that one of those fails to load and comment here.
Comment 4 Maik Qualmann 2019-08-07 12:02:15 UTC
The "" in the description are the cause. That should be easy to fix.

Maik
Comment 5 jon33040 2019-08-07 12:07:31 UTC
(In reply to Maik Qualmann from comment #4)
> The "" in the description are the cause. That should be easy to fix.
> 
> Maik

Do they need to be escaped in one of the upload requests?

I can upload the same picture to Google Photos via the web interface & it takes the description from the exif and correctly handles the "".
Comment 6 Maik Qualmann 2019-08-07 17:53:24 UTC
Git commit 19490eb10de0444219e8b525bb75513c046d184d by Maik Qualmann.
Committed on 07/08/2019 at 17:52.
Pushed by mqualmann into branch 'master'.

fix upload error to Google Photo when description contains quotes
FIXED-IN: 6.3.0

M  +2    -1    NEWS
M  +1    -0    core/dplugins/generic/webservices/google/gswindow.cpp

https://invent.kde.org/kde/digikam/commit/19490eb10de0444219e8b525bb75513c046d184d