pCloud / pcloud-sdk-swift

The official pCloud Swift SDK for iOS and macOS for integration with the pCloud API.
MIT License
22 stars 7 forks source link

Uploading a zero-byte file #24

Closed demoszp closed 1 week ago

demoszp commented 2 months ago

Hi team, When uploading a zero-byte file using the method PCloudClient.upload(fromFileAt, toFolder, asFileNamed), the file is uploaded to the server, but the method returns the error NSURLErrorDomain/NSURLErrorTimedOut. I suppose that upon a successful upload, the method should not return an error.

tmpit commented 2 months ago

Hey, I'll take a look and will probably have more information tomorrow.

tmpit commented 1 month ago

Seems to be a server issue. I'm forwarding this to our back end team and will get back to you when I have a response.

tmpit commented 1 week ago

It seems this won't be fixed in a timely manner. The only thing I can recommend is to work around the issue by using the createUpload(), getUploadInfo(), upload(*,toUpload:), saveUpload() family of methods on the PCloudClient. It is a bit more involved but allows for more flexibility.

wws13 commented 1 week ago

can you give me a code example for this work around, if I call createUpload and upload(Data(),toUpload:uploadId) I receive same NSURLErrorTimedOut error, if createUpload and then saveUpload (without upload(*,toUpload:)) it crashed in PCloudSDKSwift

tmpit commented 1 week ago

It's the second approach if you want to create an empty file: createUpload() then saveUpload()

I tested it and found the reason for the crash. The response doesn't get parsed correctly. I'll release a fix tomorrow.