Skip to content

Commit

Permalink
Merge pull request nmrshll#2 from gphotosuploader/fix-issue-9
Browse files Browse the repository at this point in the history
Add an accepted status on response
  • Loading branch information
pacoorozco committed Jul 8, 2019
2 parents 3fa98bc + 42458f5 commit 48f2842
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib-gphotos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ func (client *Client) UploadFile(filePath string, pAlbumID ...string) (*photosli
return nil, stacktrace.NewError("len(batchResults) should be 1")
}
result := batchResponse.NewMediaItemResults[0]
if result.Status.Message != "OK" {
return nil, stacktrace.NewError("status message should be OK, found: %s", result.Status.Message)
if result.Status.Message != "OK" && result.Status.Message != "Success" {
// TODO: We should use a different field like `googleapi.ServerResponse`
return nil, stacktrace.NewError("status message should be OK/Succecc, found: %s", result.Status.Message)
}

log.Printf("%s uploaded successfully as %s", filename, result.MediaItem.Id)
Expand Down

0 comments on commit 48f2842

Please sign in to comment.