Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Escape version in NSIS Updater during replace #5655

Merged
merged 3 commits into from
Mar 18, 2021

Commits on Mar 16, 2021

  1. fix: Escape version in NSIS Updater during replace

    The updater derives the path to the old blockmap file by using the url of the new blockmap file and changing the version. The code uses a RegEx with the replace function in order to replace all occurences of the version number.
    The problem is that the version number is a string like '0.1.9-2+273e2eb' and contains characters like '.' and '+' that get interpreted as regex characters. This works in most cases since a simple version string like '0.1.9' qill accidentally match. I initially tried using String.ReplaceAll but it was only recently added in Chrome 85. Some sort of escaping needs to happen, so I used lodash.escapeRegExp since the project already seems to be using lodash.
    burnhamup committed Mar 16, 2021
    Configuration menu
    Copy the full SHA
    95556ac View commit details
    Browse the repository at this point in the history
  2. Refactored and added test case

    Moved the blockmapFiles generation code into its own function as suggested by mmaietta. Added a testcase that fails without the call to escapeRegExp
    burnhamup committed Mar 16, 2021
    Configuration menu
    Copy the full SHA
    e83fa7c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4ac63f2 View commit details
    Browse the repository at this point in the history