[Webkit-unassigned] [Bug 284457] 'webkitdirectory' Attribute not working as expected in Safari for folder uploads

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 24 01:46:02 PST 2024


https://bugs.webkit.org/show_bug.cgi?id=284457

--- Comment #7 from Karl Dubost <karlcow at apple.com> ---
Yes the MDN doc says that people can select directories, because in the case of input type=file, the user can NOT select directories, as each time you navigate into it. On the other hand it doesn't say the selection of files is forbidden. 

It makes a bit hard to resonate about it because this is a non-standard feature. 
There is a document from the WICG (aka non standard) which is making a description 
https://wicg.github.io/entries-api/#html-forms

The document there says:

> The webkitdirectory attribute is a boolean attribute that indicates 
> whether the user is to be allowed to select a directory 
> rather than a file or files. 

MY EMPHASIS
> When specified, the **behavior on the selection of a directory is 
> as if all files with that directory as an ancestor were selected**. 

> In addition, the webkitRelativePath property of each File is set to 
> a relative path starting from (and including) the selected directory to the file.

It doesn't say in the UI that files should be nested files should not be selectable. 

OK. But let's try with a more direct example

```
foo
foo/blahblah.png
foo/bar
foo/bar/file2.txt
foo/bar/file3.txt
foo/bar/file1.txt
```

1. Simple case: select bar

The result is the same for all browsers

bar/file2.txt
bar/file3.txt
bar/file1.txt

2. select a file inside bar

In Safari, it returns an empy list.


In Firefox, and Chrome, we can't do anything and it forces to download the directory.
bar/file2.txt
bar/file3.txt
bar/file1.txt


3. select foo

In all 3 browsers.

foo/blahblah.png
foo/bar/file2.txt
foo/bar/file3.txt
foo/bar/file1.txt


So Probably Safari should make it impossible to validate the empty upload.

Another difference. Both Chrome and Firefox warns about accepting the upload.
Safari just does it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241224/58e2d4a8/attachment.htm>


More information about the webkit-unassigned mailing list