Skip to content

Commit c36ab5b

Browse files
dlechokonet
authored andcommitted
fix: work around Chromium File System Access API bug
This works around https://crbug.com/1264708 by always including a description in the FilePickerAcceptType passed to the options of window.showOpenFilePicker(). Fixes react-dropzone#1127. Fixes react-dropzone#1222. Fixes react-dropzone#1190.
1 parent 8127759 commit c36ab5b

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

src/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,7 @@ describe("useDropzone() hook", () => {
15371537
multiple: true,
15381538
types: [
15391539
{
1540+
description: "Files",
15401541
accept: { "application/pdf": [] },
15411542
},
15421543
],

src/utils/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ export function pickerOptionsFromAccept(accept) {
226226
);
227227
return [
228228
{
229+
// description is required due to https://crbug.com/1264708
230+
description: "Files",
229231
accept: acceptForPicker,
230232
},
231233
];

src/utils/index.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ describe("pickerOptionsFromAccept()", () => {
413413
})
414414
).toEqual([
415415
{
416+
description: "Files",
416417
accept: {
417418
"image/*": [".png", ".jpg"],
418419
"text/*": [".txt", ".pdf"],

0 commit comments

Comments
 (0)