File extension validator should look for extensions at the end of filename only
alexxxnf opened this issue · 2 comments
alexxxnf commented
Hello!
Thank you for this nice directive.
I think file extension validator works incorrectly when in builds regexp from string or array. Regexp matches extensions anywhere in the file name. For example validator .txt
considers the following value as valid readme.txt.bak
.
I think the correct regexp should be like this: /.(?:\.txt|\.text)$/i
.
jwelker110 commented
Thank you for taking the time to provide some feedback and highlight an inconsistency in the code and documentation!
You are correct, and I will adjust the handling of the Regex so that it matches against the end of the extension.
jwelker110 commented
This is fixed in version 1.0.13 (Angular 4 / 5) and 2.0.2 (Angular 6).