fix: override contentLength to return size of data

This commit is contained in:
Manuel Jenny 2021-03-16 17:34:01 +01:00
parent ad8d5338ca
commit b08a9cb549
No known key found for this signature in database
GPG Key ID: 1C80FE62B2BEAA18

View File

@ -187,6 +187,11 @@ class PCloudImpl {
.withValue(done));
com.pcloud.sdk.DataSource pCloudDataSource = new com.pcloud.sdk.DataSource() {
@Override
public long contentLength() {
return data.size(context).get();
}
@Override
public void writeTo(BufferedSink sink) throws IOException {
try (Source source = Okio.source(data.open(context))) {
@ -196,7 +201,7 @@ class PCloudImpl {
};
return client() //
.createFile(((PCloudFolder) file.getParent()).getId(), file.getName(), pCloudDataSource, new Date(), listener, uploadOptions) //
.createFile(file.getParent().getId(), file.getName(), pCloudDataSource, new Date(), listener, uploadOptions) //
.execute();
}