HomePhorge

Added methods for manipulating URI and file paths
0ce60a569604Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Added methods for manipulating URI and file paths

Added Puppet::Util.path_to_uri and uri_to_path. These methods will be
needed to support Windows file paths as the file 'source' property,
metadata, and indirector.

The path_to_uri method takes an absolute path and constructs a file
URI, e.g. 'file:/foo'. Note this is equivalent to 'file:///foo' as in
both cases the authority component of the URI is optional.

On Windows local file paths are typically URI-ized as 'file:/C:/foo'
(or 'file:///C:/foo'), whereas 'file://host/C:/foo' is used to express
UNC paths.

The uri_to_path method takes a URI (not necessarily a file URI) and
extracts the unescaped path portion. So given a URI of
'file:/foo%20bar', the method returns '/foo bar'.

On Windows, this method strips the leading slash from file URIs that
contain drive letters. It also converts UNC URIs of the form
'file://host/share/file' to '//host/share/file'

Details

Provenance
Josh Cooper <josh@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU71ba92cd09b3: Restrict the absolute path regex to the start of the string
Branches
Unknown
Tags
Unknown

Event Timeline

Josh Cooper <josh@puppetlabs.com> committed rPU0ce60a569604: Added methods for manipulating URI and file paths (authored by Josh Cooper <josh@puppetlabs.com>).Sep 27 2011, 8:20 PM