mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
quote data in regex
People can choose fancy names for vmware objects (e.g. "Datacenter V++"). Make sure that such input doesn't break the regex.
This commit is contained in:
parent
c204dbda76
commit
f5eb54d4cf
1 changed files with 1 additions and 1 deletions
|
@ -31,7 +31,7 @@ module Fog
|
|||
dc_root_folder = dc.vmFolder
|
||||
# Filter the root path for this datacenter not to be used."
|
||||
dc_root_folder_path=dc_root_folder.path.map { | id, name | name }.join("/")
|
||||
paths = path.sub(/^\/?#{dc_root_folder_path}\/?/, '').split('/')
|
||||
paths = path.sub(/^\/?#{Regex.quote(dc_root_folder_path)}\/?/, '').split('/')
|
||||
|
||||
return dc_root_folder if paths.empty?
|
||||
# Walk the tree resetting the folder pointer as we go
|
||||
|
|
Loading…
Reference in a new issue