cloudinary / CloudinaryDotNet

Cloudinary DotNet library
MIT License
102 stars 69 forks source link

Upload file larger then 2Gb #273

Closed teosangio79 closed 3 years ago

teosangio79 commented 3 years ago

Bug report for Cloudinary .NET SDK

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

When you try to upload a file larger then 2Gb (video) the SDk get an exception

Issue Type (Can be multiple)

Steps to reproduce

Upload a video larger then 2Gb

Error screenshots or Stack Trace (if applicable)

Unhandled Exception: System.IO.IOException: An attempt was made to move the file pointer before the beginning of the file.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin) at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin) at CloudinaryDotNet.ApiShared.SetStreamToStartAndCreateWriter(FileDescription file, Stream stream) at CloudinaryDotNet.ApiShared.GetRangeFromFile(FileDescription file, Stream stream) at CloudinaryDotNet.ApiShared.PrepareMultipartFormDataContent(SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders) at CloudinaryDotNet.ApiShared.PrepareRequestContent(HttpRequestMessage request, SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders) at CloudinaryDotNet.ApiShared.PrepareRequestBody(HttpRequestMessage request, HttpMethod method, SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders) at CloudinaryDotNet.ApiShared.Call(HttpMethod method, String url, SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders) at CloudinaryDotNet.ApiShared.CallAndParse[T](HttpMethod method, String url, SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders) at CloudinaryDotNet.ApiShared.CallApi[T](HttpMethod method, String url, BaseParams parameters, FileDescription file, Dictionary`2 extraHeaders) at CloudinaryDotNet.Cloudinary.UploadLarge[T](BasicRawUploadParams parameters, Int32 bufferSize) at CloudinaryDotNet.Cloudinary.UploadLarge(VideoUploadParams parameters, Int32 bufferSize)

OS and Version

Versions and Libraries (fill in the version numbers)

Repository

If possible, please provide a link to a reproducible repository that showcases the problem

teosangio79 commented 3 years ago

To fix the issue I changed: FileDescription class internal long BytesSent;

before it was 'internal int BytesSent;'

const-cloudinary commented 3 years ago

@teosangio79 , feel free to open a pull request with the fix.

teosangio79 commented 3 years ago

I created it https://github.com/cloudinary/CloudinaryDotNet/pull/274

const-cloudinary commented 3 years ago

@teosangio79 , thank you for contribution!