mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
530 stars 343 forks source link

Fix issue #809: revision-date parsed wrong if >1 @ in path #810

Closed mlittlej closed 2 years ago

mlittlej commented 2 years ago

If bin/pyang is given a path to a YANG file which contains more than one '@' character (e.g. if there's an '@' in a parent directory), the re_filename regexp will detect the revision-date as being everything from the first instances of the '@' char in the path, to the yang/tin suffix(es).

This fails to match the expected 'YYYY-MM-DD' date format that the revision-date in the filename should take and pyang fails.

This commit fixes re_filename regexp so that it disregards all characters in the filepath before the last directory separator (based on the value of os.sep) in the string.

mbj4668 commented 2 years ago

Thanks for the report and fix!