aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-10-25 10:31:03 +0200
committerGitHub <noreply@github.com>2016-10-25 10:31:03 +0200
commit79706e0ddc6ab970d5709e89b8d0caec4d34662b (patch)
tree168f9bc806e7eed287bce63e7f6d277eb5adb956 /core/js/js.js
parent5926da3dd6535e0eea7fe7871d2347f8b33bb337 (diff)
parentc8a13f644ebbc5840d0e632cf86e5ae46856f7f0 (diff)
downloadnextcloud-server-79706e0ddc6ab970d5709e89b8d0caec4d34662b.tar.gz
nextcloud-server-79706e0ddc6ab970d5709e89b8d0caec4d34662b.zip
Merge pull request #1283 from nextcloud/us_files-ui-webdav-upload
Use Webdav PUT for uploads
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 16da273c8e1..0db9967094b 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -423,6 +423,28 @@ var OC={
},
/**
+ * Returns whether the given paths are the same, without
+ * leading, trailing or doubled slashes and also removing
+ * the dot sections.
+ *
+ * @param {String} path1 first path
+ * @param {String} path2 second path
+ * @return {bool} true if the paths are the same
+ *
+ * @since 9.0
+ */
+ isSamePath: function(path1, path2) {
+ var filterDot = function(p) {
+ return p !== '.';
+ };
+ var pathSections1 = _.filter((path1 || '').split('/'), filterDot);
+ var pathSections2 = _.filter((path2 || '').split('/'), filterDot);
+ path1 = OC.joinPaths.apply(OC, pathSections1);
+ path2 = OC.joinPaths.apply(OC, pathSections2);
+ return path1 === path2;
+ },
+
+ /**
* Join path sections
*
* @param {...String} path sections