Closed ewilligers closed 5 years ago
An alternate approach, if we wanted to discard only individual accept
entries, might be to say that an empty accept
array makes the whole files
entry invalid. If people want to accept arbitarary files, that would be expessed explicitly with "accept": ["*/*"]
instead of "accept": []
Instead of setting name to empty string, then later removing buckets with an empty name (which feels a bit round-about), could you just go back to the old logic, but replace "return undefined" with "remove bucket from the list and continue". In most programming languages, you're not supposed to delete an element from the array while iterating over it, but I don't see why we need to do that in "spec language".
@raymeskhoury FYI
The issue/PR came from a comment by @mounirlamouri.
Wording has been updated based on Matt's suggestion.
An alternate approach, if we wanted to discard only individual accept entries, might be to say that an empty accept array makes the whole files entry invalid. If people want to accept arbitarary files, that would be expessed explicitly with "accept": ["/"] instead of "accept": []
I think that's reasonable, considering most apps should be filtering by a particular format. If you really want to accept files of any type, you should have to ask for it.
So do you want to make the above change you suggested, or should I just approve this?
If you really want to accept files of any type, you should have to ask for it.
I've made the change.
If the name is an empty string, discard that files entry instead of rejecting the entire share target.
If an accept entry is invalid, discard that accept entry instead of rejecting either the files entry or the entire share target.
If accept is an empty array (either initially or because it only contained invalid entries), discard the files entry.
Note an an empty accept array previously had the opposite meaning, i.e. that the files entry accepted all files.
resolves #77
Preview | Diff