Uploading file with WebDav returns incorrect FileCount in API result

  • 1
  • Problem
  • Updated 3 weeks ago
  • (Edited)
Hi all

I have a weird issue with files uploaded using WebDav and the FileCount-key in the json returned from the ShareFile API.

1. I Upload a file using WebDav (e.g "Picture.jpg") in a empty folder
2. I ask for the folder contents using the ShareFile API (GET https://account.sf-api.com/sf/v3/Items(folderid)?getChildren=true)
3. In the json returned from the API the FileCount-key is set to 2 instead of 1. The Children-key contains 1 item (the uploaded file).

This behaviour only happens with files uploaded using WebDav. When I upload files using ShareFile Web or Sync for Mac the renaming using ShareFile API is handled ok.

Does anybody has a clue what's going wrong?

Thanks in advance for your reply.
Photo of kapersoft

kapersoft

  • 2 Posts
  • 0 Reply Likes

Posted 3 weeks ago

  • 1
Photo of Michael Berrier

Michael Berrier, Employee

  • 115 Posts
  • 23 Reply Likes
kapersoft,

Thanks for reporting this! I'm able to reproduce the same behavior on my own account. It appears that our WebDAV integration processes newly uploaded files twice. At least for accounts that have versioning enabled, the duplicate version is treated as an additional file within the folder for the purposes of calculating the FileCount property. I will log this as a defect and get it prioritized to fix.

Michael
(Edited)
Photo of Luke Skrzypek

Luke Skrzypek, Employee

  • 48 Posts
  • 5 Reply Likes
Hi,

I'm assuming you have file versioning enabled for your account as it's the default. You can verify this under Admin Settings>Advanced Preferences>File Settings in the web app. The FileCount of a folder will take into account multiple versions of the same file.
The FileCount is incremented two per file when uploading via WebDAV because many WebDAV clients (like Windows Explorer) will first upload a 0-byte version of the file to verify whether the user has permission to do so. It will then overwrite that file with a new one containing the actual file contents.

In ShareFile, this translates to overwriting the existing file with a new version. So the FileCount will be incremented, but you will only see the latest version returned in the json response. You can double check this by navigating to the file in webapp, and you should see that it has multiple versions available.
(Edited)