diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-07-18 22:44:10 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-07-19 14:03:42 -0700 |
| commit | 45ae5b4a9ced26dfcd3e324391f9a26cb02bf93d (patch) | |
| tree | b61ccc5270617529b3e7113b2356f882ab53cb38 /lib/puppet/file_serving | |
| parent | 26ee468e8b963d63933d9a27a65d55510ff87618 (diff) | |
(#8268) Require windows drive letters in absolute file paths
When testing whether a file path is absolute, the regexp was only
handling POSIX style file paths. This commit requires Windows
style file paths to start with a drive letter. A future commit
will refacter the various places we do path validation to
support both Windows drive letters and UNC paths.
Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'lib/puppet/file_serving')
| -rw-r--r-- | lib/puppet/file_serving/fileset.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index f29f70a53..b4f1457df 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -59,8 +59,13 @@ class Puppet::FileServing::Fileset end def initialize(path, options = {}) - path = path.chomp(File::SEPARATOR) unless path == File::SEPARATOR - raise ArgumentError.new("Fileset paths must be fully qualified") unless File.expand_path(path) == path + if Puppet.features.microsoft_windows? + # REMIND: UNC path + path = path.chomp(File::SEPARATOR) unless path =~ /^[A-Za-z]:\/$/ + else + path = path.chomp(File::SEPARATOR) unless path == File::SEPARATOR + end + raise ArgumentError.new("Fileset paths must be fully qualified: #{path}") unless File.expand_path(path) == path @path = path |
