This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Add X-Goog-Upload-Protocol header when uploading files for filenames to work #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for gpup @int128! It seems to be the only working way to properly more or less automate uploads to Google Photos uninteractively.
However, files uploaded with gpup do not keep their filenames and rather get renamed to YYYY-MM-DD.JPG/RW2 (you can see this in Picture info or if you have the option to show uploaded files in Google Drive).
It seems this was an issue with the API on Google's side (since the filename was sent as
X-Goog-Upload-File-Namealready) that was fixed on https://issuetracker.google.com/issues/79757390.However it does not work unless you also send the
X-Goog-Upload-Protocolwith arawvalue, which this PR adds.This fixes the issue, however it seems to have the gotcha that images that were previously already uploaded with gpup without filenames will get duplicated when uploaded with filenames (maybe due to this different metadata).
Haven't been able to test this behavior much, so open to suggestions on that front (maybe worth adding to the README/changelog, or having a flag to disable filename uploading?).