Skip to content

Commit 6edc0c8

Browse files
committed
Land rapid7#8882, Add ./ to cmd_use for paths and simplify cases
2 parents 4c285c0 + 100afaf commit 6edc0c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/msf/ui/console/command_dispatcher/modules.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,11 @@ def cmd_use(*args)
573573
mod_name = args[0]
574574

575575
# Ensure we have a reference name and not a path
576-
if mod_name.start_with?('modules/', '/')
577-
mod_name.sub!(/^(?:modules)?\//, '')
576+
if mod_name.start_with?('./', 'modules/')
577+
mod_name.sub!(/^(?:\.\/)?modules\//, '')
578578
end
579-
if mod_name.end_with?('.', '.r', '.rb')
580-
mod_name.sub!(/\.(?:rb?)?$/, '')
579+
if mod_name.end_with?('.rb')
580+
mod_name.sub!(/\.rb$/, '')
581581
end
582582

583583
begin

0 commit comments

Comments
 (0)