Bug 25879 - WebKit should either handle directory uploads or refuse directory drags
: WebKit should either handle directory uploads or refuse directory drags
Status: NEW
: WebKit
New Bugs
: 528+ (Nightly build)
: Macintosh Mac OS X 10.5
: P2 Normal
Assigned To:
:
:
: 21115 25852
: 25913
  Show dependency treegraph
 
Reported: 2009-05-19 17:52 PST by
Modified: 2009-06-05 10:58 PST (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-05-19 17:52:40 PST
It's currently possible to drag a directory onto a <input type="file"> control.  It's not possible to pick one from the file picker.

If we're going to support dragging directories onto a file control we need to do something intelligent (like auto-zipping the directory on submission).

If we don't want to support dragging directories onto file controls, we need a good UI for when we prevent it (like showing the "can't drop" cursor during the drag).

If a drag has both files and directories in it, we should treat it the same as if it just has a directory, I think.  Either way we need to handle this case.


Currently when you try to submit a directory, we do the following:

Safari can’t open the page.
Safari can’t open the page “https://bugs.webkit.org/attachment.cgi”. The error is: “Operation could not be completed. Is a directory” (NSPOSIXErrorDomain:21) Please choose Safari > Report Bugs to Apple, note the error number, and describe what you did before you saw this message.

Instead we should throw a JS exception on form.submit() or something (or maybe we already do, I clicked the "submit" button manually).

I can break this into multiple bugs as needed.
------- Comment #1 From 2009-05-19 17:55:30 PST -------
Three tests for directory dragging are being added in editing/pasteboard/file-input-files-access.html as part of bug 25852.
------- Comment #2 From 2009-05-21 00:32:57 PST -------
Looks like the zipping behavior is intended!
https://bugs.webkit.org/show_bug.cgi?id=21115
------- Comment #3 From 2009-05-21 00:46:44 PST -------
Zipping behavior is client defined, it seems.  I guess the current Safari client only choses to zip bundles, leaving CF Network to fail when trying to send directories.

This bug is about that we should *refuse* the drag if we can't handle them.  Or handle the directories properly if we accept the drag.  Anything else is confusing to the user.
------- Comment #4 From 2009-05-21 00:47:57 PST -------
Changing title to "WebKit should either handle directory uploads or refuse directory drags"
currently we both accept the drag and fail the upload, see the above mentioned CFNetwork error message.
------- Comment #5 From 2009-05-21 00:49:58 PST -------
Related https://bugs.webkit.org/show_bug.cgi?id=25913