Closed partynikko closed 2 years ago
reason to use match is because the file might contain, a extension and iteration number if using size as a rotation condition and only should match the beginning of the filename. if it matches then looks for the iteration number in that filename to set the iteration to use in the next file.
Plan to rewrite the module for latest JS in the coming months and I'll escape the filename when doing the matching but since this has not been raised as an issue by others, I'll leave it as is for now.
Thanks for raising issue.
There are scenarios where the
FileStreamRotator
will crash due to the following line: https://github.com/rogerc/file-stream-rotator/blob/d48e1ec847bd27bc7896462d0e56ba19f07c581e/FileStreamRotator.js#L483Since the filename comparison uses a dynamic RegEx there are scenarios where the
.match
will crash due to unescaped characters in the path.For example consider a path where the
(
characters exists which is an opening of a capture group. If no closing exists, the script will crash with an syntax error regarding not closing a capture group.Is there a reason why this has to use
.match
? Wouldn't it suffice with something like:Let me know what you think and I'll create a PR for it :)
Thanks BR