{"action":"opened","issue":{"url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/716","labels_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/716/labels{/name}","comments_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/716/comments","events_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/716/events","html_url":"https://github.com/danialfarid/ng-file-upload/issues/716","id":72807287,"number":716,"title":"Document ngf-accept validation function semantics","user":{"login":"rguldener","id":682011,"avatar_url":"https://avatars.githubusercontent.com/u/682011?v=3","gravatar_id":"","url":"https://api.github.com/users/rguldener","html_url":"https://github.com/rguldener","followers_url":"https://api.github.com/users/rguldener/followers","following_url":"https://api.github.com/users/rguldener/following{/other_user}","gists_url":"https://api.github.com/users/rguldener/gists{/gist_id}","starred_url":"https://api.github.com/users/rguldener/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rguldener/subscriptions","organizations_url":"https://api.github.com/users/rguldener/orgs","repos_url":"https://api.github.com/users/rguldener/repos","events_url":"https://api.github.com/users/rguldener/events{/privacy}","received_events_url":"https://api.github.com/users/rguldener/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-03T13:35:45Z","updated_at":"2015-05-03T13:35:45Z","closed_at":null,"body":"Please add documentation to clarify the behavior of the validation function `validate($file)` that can be passed into `ngf-accept`. Currently the only way to know what to return to indicate a valid or invalid file is to read the source. To make matters worse, 9d3227f96ba6e5e7cac4d35f55ea69a22307f010 has significantly altered its semantics without any mention in the release notes.\r\n\r\nThree suggestions:\r\n\r\n1. Add documentation to `README.md` to explain the semantics of the validation function: Return null to indicate a valid file, return a non-null, non-string value to indicate an invalid file. Return a string if you want that string to be interpreted as a RegEx and check if the filename matches against that.\r\n\r\n2. Add a note to the 4.0.0 release notes that clarifies the change in validation semantics. Previously returning `true` from the validation function indicated an accepted file and returning `false` indicated an invalid file.\r\n\r\n3. Rethink the current semantics, I think the 3.x semantics were much more in line with normal validation function semantics. The current one is pretty confusing, especially the string-as-regex special case."}}