WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
229456
[iOS] Unable to select files when the accept attribute is set to "*/*"
https://bugs.webkit.org/show_bug.cgi?id=229456
Summary
[iOS] Unable to select files when the accept attribute is set to "*/*"
Lee Nave
Reported
2021-08-24 11:19:37 PDT
Given a web form with a file upload field with the accept attribute set to "*/*", like this: <input type="file" accept="*/*"> Desktop browsers will ignore the accept attribute and allow any file to be uploaded. On iOS, however, this is not the case and instead of being given the equivalent experience (which would be the "Photo Library / Take Photo / Browse" menu), the user is dropped into the file browser but without the ability to actually select any files (they are grayed out). Granted, "*/*" is not a valid accept value per the spec. However, based on searching google for "ios upload grayed out" it is clear that many sites are setting this attribute and causing problems for iOS users. This behavior is difficult to diagnose and inconsistent with the desktop experience. This can be easily reproduced here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file
Attachments
Patch
(7.07 KB, patch)
2021-08-25 13:56 PDT
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Patch
(7.04 KB, patch)
2021-08-25 14:14 PDT
,
Aditya Keerthi
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-08-24 12:31:18 PDT
"*/*" actually seems like a valid value according to the spec: -
https://html.spec.whatwg.org/multipage/input.html#attr-input-accept
says "A valid MIME type string with no parameters" points to: -
https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters
which points to: -
https://mimesniff.spec.whatwg.org/#valid-mime-type
which points to: -
https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.1
says: media-type = type "/" subtype *( OWS ";" OWS parameter ) type = token subtype = token type and subtype are both tokens, defined here: -
https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
so it seems like '*' is a valid token.
Lee Nave
Comment 2
2021-08-24 12:38:54 PDT
Ah, you're right, thanks!
Radar WebKit Bug Importer
Comment 3
2021-08-25 10:27:50 PDT
<
rdar://problem/82346315
>
Aditya Keerthi
Comment 4
2021-08-25 13:56:23 PDT
Created
attachment 436422
[details]
Patch
Chris Dumez
Comment 5
2021-08-25 14:02:56 PDT
Comment on
attachment 436422
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=436422&action=review
r=me with comment
> Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:358 > + if ([mimeType caseInsensitiveCompare:@"*/*"] == NSOrderedSame)
nit: Do we really need a caseInsensitiveCompare for "*/*"?
Aditya Keerthi
Comment 6
2021-08-25 14:14:17 PDT
Created
attachment 436425
[details]
Patch
Aditya Keerthi
Comment 7
2021-08-25 14:15:55 PDT
(In reply to Chris Dumez from
comment #5
)
> Comment on
attachment 436422
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=436422&action=review
> > r=me with comment
Thanks for the review!
> > Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm:358 > > + if ([mimeType caseInsensitiveCompare:@"*/*"] == NSOrderedSame) > > nit: Do we really need a caseInsensitiveCompare for "*/*"?
Uploaded a new patch using `isEqualToString:`.
EWS
Comment 8
2021-08-25 20:08:49 PDT
Committed
r281612
(
240968@main
): <
https://commits.webkit.org/240968@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 436425
[details]
.
Lee Nave
Comment 9
2021-09-27 16:29:20 PDT
I just have to say, I'm really impressed with how quickly this bug was fixed. My first time cutting a WebKit issue and was expecting this to sit uncommented and then closed eventually for "no activity" or any of the other outcomes that seem common with large open-source projects supported by any of the Big 5. Very glad to be proven wrong. My only complaints is that I was looking forward to figuring out WebKit development and fixing it myself :-)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug