Move escape function to util and clarify name

This commit is contained in:
markturansky
2015-03-24 10:39:51 -04:00
parent a4c02d8ede
commit 2fd82f60f4
9 changed files with 50 additions and 23 deletions

View File

@@ -173,18 +173,3 @@ func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error) {
}
return pm.plugins[matches[0]], nil
}
// EscapePluginName converts a plugin name, which might contain a / into a
// string that is safe to use on-disk. This assumes that the input has already
// been validates as a qualified name. we use "~" rather than ":" here in case
// we ever use a filesystem that doesn't allow ":".
func EscapePluginName(in string) string {
return strings.Replace(in, "/", "~", -1)
}
// UnescapePluginName converts an escaped plugin name (as per EscapePluginName)
// back to its normal form. This assumes that the input has already been
// validates as a qualified name.
func UnescapePluginName(in string) string {
return strings.Replace(in, "~", "/", -1)
}