You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using ng-accept="'*.apk'" will allow selecting.apk` files but the file picker doesn't filter anything
using ng-accept="'.apk'" filters the file picker, but rejects.apk` files after it's picked.
using ng-accept="'.apk," (note comma) will allow selecting .apk files with a filtered file picker dialog, this is what ng-accept="'.apk'"should do.
I believe this is because the globStringToRegex function is used to filter out files after they're accepted. Given .apk isn't a glob, globStringToRegex converts it into a regex like /^\.apk$/, which obviously doesn't match apk files with a filename.
I suggest adding another line to the globStringToRegex function, which (if no comma is present) checks for the first character being a ., and creates a wildcarded glob like so:
With Chrome:
ng-accept="'*.apk'" will allow selecting
.apk` files but the file picker doesn't filter anythingng-accept="'.apk'" filters the file picker, but rejects
.apk` files after it's picked.ng-accept="'.apk,"
(note comma) will allow selecting.apk
files with a filtered file picker dialog, this is whatng-accept="'.apk'"
should do.I believe this is because the
globStringToRegex
function is used to filter out files after they're accepted. Given.apk
isn't a glob,globStringToRegex
converts it into a regex like/^\.apk$/
, which obviously doesn't match apk files with a filename.I suggest adding another line to the
globStringToRegex
function, which (if no comma is present) checks for the first character being a.
, and creates a wildcarded glob like so:This means
globStringToRegex('.apk') === "^\.apk$"
which is much more useful.The text was updated successfully, but these errors were encountered: