Skip to content

Commit 6963d48

Browse files
committed
Use Regexp.escape to not need to manually escape (error-prone)
1 parent 3fc6249 commit 6963d48

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

generate-windows-versions.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
# General rules:
66
# - All the static parts of the expected URL are checked literally.
7-
# - Don't forget to escape dot (`.`) and other special characters when used literally.
87
# - Each path component must begin with [\w], or a more restrictive character set.
98
# - Percent (`%`) shall not be allowed to avoid any percent encoding.
109
WINDOWS_VERSIONS_URLS_REGEXPS = [
11-
%r{\Ahttps://github\.com/oneclick/rubyinstaller2?/releases/download/\w[\w.-]*/\w[\w.-]*\z},
12-
%r{\Ahttps://github\.com/MSP-Greg/ruby-loco/releases/download/\w[\w.-]*/\w[\w.-]*\z}
10+
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller/releases/download'}/\w[\w.-]*/\w[\w.-]*\z},
11+
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller2/releases/download'}/\w[\w.-]*/\w[\w.-]*\z},
12+
%r{\A#{Regexp.escape 'https://github.com/MSP-Greg/ruby-loco/releases/download'}/\w[\w.-]*/\w[\w.-]*\z}
1313
].freeze
1414

1515
WINDOWS_TOOLCHAIN_VERSIONS_URLS_REGEXPS = [
16-
%r{\Ahttps://github\.com/oneclick/rubyinstaller/releases/download/devkit-4\.7\.2/DevKit-mingw64-64-4\.7\.2-20130224-1432-sfx\.exe\z},
17-
%r{\Ahttps://github\.com/ruby/setup-msys2-gcc/releases/download/\w[\w.-]*/\w[\w@.-]*\z},
18-
%r{\Ahttps://github\.com/ruby/setup-msys2-gcc/releases/latest/download/\w[\w@.-]*\z}
16+
%r{\A#{Regexp.escape 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'}\z},
17+
%r{\A#{Regexp.escape 'https://github.com/ruby/setup-msys2-gcc/releases/download'}/\w[\w.-]*/\w[\w@.-]*\z},
18+
%r{\A#{Regexp.escape 'https://github.com/ruby/setup-msys2-gcc/releases/latest/download'}/\w[\w@.-]*\z}
1919
].freeze
2020

2121
# Validate all the URLs in the versions json

0 commit comments

Comments
 (0)