Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDanielle Church <dani.church@gmail.com>2021-03-24 22:17:58 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-26 00:30:34 +0300
commit95ba87622e00d68270eda9e071b19737718fca16 (patch)
treee54bcd39badf77ba97c8c52ad438abffcedac690 /lib
parent2b3d1f983b4c75adfcff284573841a71f11f1146 (diff)
Fix manNumberRegex in help.js
The current regex will match any .[0-9]. pattern anywhere in the path, which will give incorrect results if npm is installed to a path like .../node-v14.5.5/... This change restricts it to only the last path element. PR-URL: https://github.com/npm/cli/pull/2949 Credit: @dmchurch Close: #2949 Reviewed-by: @wraithgar
Diffstat (limited to 'lib')
-rw-r--r--lib/help.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/help.js b/lib/help.js
index b9ff1c957..589819eb0 100644
--- a/lib/help.js
+++ b/lib/help.js
@@ -9,7 +9,7 @@ const BaseCommand = require('./base-command.js')
// Strips out the number from foo.7 or foo.7. or foo.7.tgz
// We don't currently compress our man pages but if we ever did this would
// seemlessly continue supporting it
-const manNumberRegex = /\.(\d+)(\..*)?$/
+const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/
class Help extends BaseCommand {
/* istanbul ignore next - see test/lib/load-all-commands.js */