Skip to content

Uploading new version of a file makes its size zero #594

@madhmeht

Description

@madhmeht
  • I have checked that the [SDK documentation][https://github.com/box/box-java-sdk/blob/master/doc/files.md] [API documentation][https://developer.box.com/reference] doesn't solve my issue

While uploading a file, I use BoxFolder#uploadFile(fileContents, fileName) method. It throws an error if a file with the same name exists. In the catch block, I use File#uploadVersion(stream) to upload the new version. This method does not throw any error but the file size of the new version is zero.

If I use BoxFolder#canUpload(fileName, 98734576), this also throws the same error. The new version uploaded in the catch block gets uploaded correctly with the correct size.
I am not sure what gets enabled on backend after this preflight check.
If I am uploading 20 files out of which just 2 files already exist on Box, I would prefer to make 22 API requests instead of 40 API requests.

Versions Used

Java SDK: JDK 8u101
Box sdk - box-java-sdk:2.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAdded to questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions