f2calv / CasCap.Apis.GooglePhotos

*unofficial* Google Photos REST API library for .NET projects.
MIT License
60 stars 11 forks source link

Unable to upload files bigger than 2 GB in ResumableMultipart mode #111

Closed Belfegor1991 closed 2 years ago

Belfegor1991 commented 2 years ago

Uploading files with sizes more than 2 GB fails in ResumableMultipart mode with JsonReaderException:

Error parsing Infinity value. Path '', line 1, position 2.

The reason is that variable offset in the method GooglePhotosServiceBase.UploadMediaAsync is Int32. As a result when loading files with sizes greater than Int32.MaxValue, offset overflows to a negative value passed to the HTTP header.

The solution would be to change the type of offset variable to Int64:

var offset = 0L;

f2calv commented 2 years ago

Thanks for the alert+fix, I hope to roll this fix out in the next couple of days as part of https://github.com/f2calv/CasCap.Apis.GooglePhotos/pull/112