Commit b7acb0f7 authored by Benjamin Fischer's avatar Benjamin Fischer
Browse files

Utils: added tool to clean file paths (of /./ and /foo/../)

parent d06837d9
...@@ -268,6 +268,21 @@ define(["require"], function(require) { ...@@ -268,6 +268,21 @@ define(["require"], function(require) {
} }
}; };
}, },
/** indent: 1
* .. js:function:: cleanPath(path)
*
* :param String path: The path to clean up.
*
* :return: The cleaned path.
* :rtype: String
*/
cleanPath: function (path) {
return path.
replace(/\/+/g, "/").
replace(/\/\.(?=\/|$)/g, "").
replace(/\/[^\/]+\/\.\.(?=\/|$)/g, "");
}
}; };
return Utils; return Utils;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment