-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with Windows based file URIs
Previously, specifying a Windows file URI of the form 'file:///C:/foo' as a file source failed to strip the leading slash when attempting to source the file. Also there was ambiguity after values were munged (a value of the form 'C:/foo' could either be a Windows file path or a URI whose scheme is 'C'). This commit changes the file source to be more deliberate in how it validates source properties, including only allowing absolute paths and 'puppet' and 'file' URIs, which are both absolute and hierarchical. Also it uses the Puppet::Util.path_to_uri method to handle file path to URI translation issues. Previously, if a request was created using a Windows file URI of the form 'file:///C:/foo', then the set_uri_key method wasn't stripping the leading slash, and setting the request key to '/C:/foo'. This caused problems when attempting to collect metadata for Windows files. This commit changes the request class to use the Puppet::Util.uri_to_path method to handle URI path to file path translation issues. Previously, if a file URI was created programmatically using ruby's built-in URI class, such as occurs when specifying file source URIs, then calling URI#to_s omits the authority component, e.g. 'file:/foo' instead of 'file:///foo'. This commit changes the URI regex to not require two slashes, but note that the order of operations is important as Windows file paths will match the URI regex and can be successfully parsed: URI.parse('c:/foo').scheme == 'c'
- Loading branch information
1 parent
1a13d24
commit 5fea1dc
Showing
11 changed files
with
390 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.