apache / apache/texera

Dropping a folder on the file uploader reports a file failure that did not happen

Open
#7,457 1 comment 0 reactions 1 assignee Claimed by @Raja-Hamid View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### What happened?

Dropping a folder onto the dataset file uploader reports a file failure that did not happen.

In `files-uploader.component.ts`, a dropped entry that is not a file resolves to `null`:

```ts
} else {
resolve(null); // directory
}
```

Those nulls are then filtered out of `successfulUploads`, but the failure count is computed against the *unfiltered* results:

```ts
const failedCount = results.length - successfulUploads.length;
if (failedCount > 0) {
this.showFileUploadBanner("error", `${failedCount} file${failedCount > 1 ? "s" : ""} failed to be selected.`);
}
```

A directory therefore counts as a failed file, even though nothing failed and nothing was meant to be uploaded.

### How to reproduce?

1. Open a dataset and drag a **folder** onto the file drop area (alone, or alongside a valid file).
2. A red banner appears: *"1 file failed to be selected."*
3. Any valid files dropped alongside it are still selected correctly — only the banner is wrong.

### Version/Branch

1.3.0-incubating-SNAPSHOT (main)

### Expected behavior

A dropped directory is not a failure. `failedCount` should count only entries that actually rejected, i.e. exclude the deliberate `resolve(null)` cases — for example by tracking rejections separately, or by counting `results.filter(r => r.status === "rejected").length` rather than deriving from the length difference.

### Additional context

Found while adding coverage for the drop path. The accompanying test asserts only that the directory is excluded from the selection and deliberately does **not** assert the banner, so the miscount is not cemented while it stands.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.