small update to pr 677 to tighten the regex #682
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to @peter- for PR 677 which found this issue and suggested a good solution to it. This is a slight update to #677 to make the regex more specific so that it can only match on the variable declaration line. I found that 677 would substitute on the line https://github.com/filesender/filesender/blob/master/scripts/client/filesender.py#L149 as well with unintended side effects. It is also tempting to use ^ and $ to limit the match scope but as the script is passed as a single string that would not match. Thus the fallback to using the newline to limit the match to only the variable declaration.
Maybe in the future we are better off building a map of configuration names that should be substituted and looping over that map doing a substitution of each configuration setting with a restrictive regex like the one in this PR. Such a solution would allow new config variables to be referenced without needing to tinker with regexes.