[GH-ISSUE #316] If a directory with a large amount of files is uploaded, only 100 files are actually uploaded #168

Closed
opened 2026-04-08 16:50:50 +03:00 by zhus · 0 comments
Owner

Originally created by @plantatorbob on GitHub (Dec 11, 2023).
Original GitHub issue: https://github.com/sigoden/dufs/issues/316

Problem

When uploading a directory (using drag-and-drop) that contains more than 100 files, only 100 files are actually uploaded.
This only happens if a directory, which contains files, is uploaded. If a batch of more than 100 files is uploaded as-is, without a directory, everything works as intended.
This partial-upload behaviour only affects Chromium-based browsers (tested in Chrome and Edge).

The problem can be traced to an incorrect use of readEntries method in File API:
https://github.com/sigoden/dufs/blob/main/assets/index.js#L736

As per MDN,

On Chrome 77, readEntries() will only return the first 100 FileSystemEntry instances. In order to obtain all of the instances, readEntries() must be called multiple times.

MDN is not very clear in their phrasing: this happens not only on Chrome 77, but on all latest Chromium-based browsers.

This means that addFileEntries function should take into account that readEntries may not return full directory listing in one call; multiple calls to readEntries may be required.

Chromium bug tracker has an issue describing this behaviour of readEntries: https://bugs.chromium.org/p/chromium/issues/detail?id=378883

Environment:

  • Dufs version: v0.38.0
  • Browser/Webdav Info: Chromium 120.0.6099.71 (ungoogled-chromium) x64
  • OS Info: Alpine 3.18.5
Originally created by @plantatorbob on GitHub (Dec 11, 2023). Original GitHub issue: https://github.com/sigoden/dufs/issues/316 **Problem** When uploading a directory (using drag-and-drop) that contains more than 100 files, only 100 files are actually uploaded. This only happens if a **directory**, which contains files, is uploaded. If a batch of more than 100 files is uploaded as-is, without a directory, everything works as intended. This partial-upload behaviour only affects Chromium-based browsers (tested in Chrome and Edge). The problem can be traced to an incorrect use of `readEntries` method in File API: https://github.com/sigoden/dufs/blob/main/assets/index.js#L736 As per [MDN](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader/readEntries), > On Chrome 77, readEntries() will only return the first 100 FileSystemEntry instances. In order to obtain all of the instances, readEntries() must be called multiple times. MDN is not very clear in their phrasing: this happens not only on Chrome 77, but on all latest Chromium-based browsers. This means that `addFileEntries` function should take into account that `readEntries` may not return full directory listing in one call; multiple calls to `readEntries` may be required. Chromium bug tracker has an issue describing this behaviour of `readEntries`: https://bugs.chromium.org/p/chromium/issues/detail?id=378883 **Environment:** - Dufs version: v0.38.0 - Browser/Webdav Info: Chromium 120.0.6099.71 (ungoogled-chromium) x64 - OS Info: Alpine 3.18.5
zhus closed this issue 2026-04-08 16:50:50 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#168