]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly join path sections
authorVincent Petry <pvince81@owncloud.com>
Wed, 18 Nov 2015 16:54:00 +0000 (17:54 +0100)
committerLukas Reschke <lukas@owncloud.com>
Sun, 22 Nov 2015 15:05:51 +0000 (16:05 +0100)
This prevents double slashes that can mess up path comparisons in some
cases.

apps/files/js/favoritesplugin.js
apps/files/js/fileactions.js
apps/files_external/js/app.js
apps/files_sharing/js/app.js
apps/files_trashbin/js/app.js

index 417a32ef804b3a6cedd6b0bd62b35720108713e7..454a505c7bd68e60c79b708fed9190325c6e3d68 100644 (file)
@@ -92,7 +92,7 @@
                        // folder in the files app instead of opening it directly
                        fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
                                OCA.Files.App.setActiveView('files', {silent: true});
-                               OCA.Files.App.fileList.changeDirectory(context.$file.attr('data-path') + '/' + filename, true, true);
+                               OCA.Files.App.fileList.changeDirectory(OC.joinPaths(context.$file.attr('data-path'), filename), true, true);
                        });
                        fileActions.setDefault('dir', 'Open');
                        return fileActions;
index 32385c424789ed416d3e515ec58794b3104e3927..871a2149c883241f64292fd24bae4767f6eacf7e 100644 (file)
 
                        this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
                                var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
-                               if (dir !== '/') {
-                                       dir = dir + '/';
-                               }
-                               context.fileList.changeDirectory(dir + filename);
+                               context.fileList.changeDirectory(OC.joinPaths(dir, filename));
                        });
 
                        this.registerAction({
index bf853f926dcf969bff35e634e7aa92df40acf79e..1bff3014bd663e9cd6e7052b5f55bf0ce9ec71e8 100644 (file)
@@ -54,7 +54,7 @@ OCA.External.App = {
                // folder in the files app instead of opening it directly
                fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
                        OCA.Files.App.setActiveView('files', {silent: true});
-                       OCA.Files.App.fileList.changeDirectory(context.$file.attr('data-path') + '/' + filename, true, true);
+                       OCA.Files.App.fileList.changeDirectory(OC.joinPaths(context.$file.attr('data-path'), filename), true, true);
                });
                fileActions.setDefault('dir', 'Open');
                return fileActions;
index 3168e930829b0d3d24bccc64fd657fef3eb512ec..af198208de2b5584c12f617b6d2d4c0e1e8d9355 100644 (file)
@@ -142,7 +142,7 @@ OCA.Sharing.App = {
                // folder in the files app instead of opening it directly
                fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
                        OCA.Files.App.setActiveView('files', {silent: true});
-                       OCA.Files.App.fileList.changeDirectory(context.$file.attr('data-path') + '/' + filename, true, true);
+                       OCA.Files.App.fileList.changeDirectory(OC.joinPaths(context.$file.attr('data-path'), filename), true, true);
                });
                fileActions.setDefault('dir', 'Open');
                return fileActions;
index 1f46f568bf2fadd60f7071139316b33935a3dd26..600a8ce2b03d03f01c753f371489cce126163d73 100644 (file)
@@ -38,10 +38,7 @@ OCA.Trashbin.App = {
                var fileActions = new OCA.Files.FileActions();
                fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
                        var dir = context.fileList.getCurrentDirectory();
-                       if (dir !== '/') {
-                               dir = dir + '/';
-                       }
-                       context.fileList.changeDirectory(dir + filename);
+                       context.fileList.changeDirectory(OC.joinPaths(dir, filename));
                });
 
                fileActions.setDefault('dir', 'Open');