Bug 25879 - WebKit should either handle directory uploads or refuse directory drags
Summary: WebKit should either handle directory uploads or refuse directory drags
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 21115 25852
Blocks: 25913
  Show dependency treegraph
 
Reported: 2009-05-19 17:52 PDT by Eric Seidel (no email)
Modified: 2009-06-05 10:58 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-05-19 17:52:40 PDT
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 Eric Seidel (no email) 2009-05-19 17:55:30 PDT
Three tests for directory dragging are being added in editing/pasteboard/file-input-files-access.html as part of bug 25852.
Comment 2 Eric Seidel (no email) 2009-05-21 00:32:57 PDT
Looks like the zipping behavior is intended!
https://bugs.webkit.org/show_bug.cgi?id=21115
Comment 3 Eric Seidel (no email) 2009-05-21 00:46:44 PDT
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 Eric Seidel (no email) 2009-05-21 00:47:57 PDT
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 Eric Seidel (no email) 2009-05-21 00:49:58 PDT
Related https://bugs.webkit.org/show_bug.cgi?id=25913