Google Photos plugin fails when trying to upload more than 50 photos due to API returning 400 Bad Request
Mandatory: Shotwell version the issue was seen with
Shotwell 0.31.2 (066fdde3)
The expected behaviour
Successfully uploads more than 50 photos
What was actually happening
It successfully individually uploads the photos but fails at the end of the upload process when calling the mediaItems:batchCreate API with the following error in the shotwell log
2020-05-25 10:46:02 [WRN] RESTSupport.vala:220: response validation failed. bad response = '{
"error": {
"code": 400,
"message": "Request must have less than 50 items.",
"status": "INVALID_ARGUMENT"
}
}
It is also written in the documentation here https://developers.google.com/photos/library/guides/upload-media that it limits media creation to 50 at a time. (However the reference documentation doesn't stipulate this https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate, so it can be confusing)
Steps to reproduce the issue
Just try to upload more than 50 photos to google photos at a time
My 2 cents.
I guess a fix could be to limit the calls to mediaItems/batchCreate to 50 at a time and call it multiple times (not in parallel as that is also prohibited) I have never used Vala (or been too good at C) but might try to take a whack at it if no one else is going to pick this up.