diff --git a/apps/files/js/favoritesplugin.js b/apps/files/js/favoritesplugin.js
index 417a32ef804b3a6cedd6b0bd62b35720108713e7..454a505c7bd68e60c79b708fed9190325c6e3d68 100644
--- a/apps/files/js/favoritesplugin.js
+++ b/apps/files/js/favoritesplugin.js
@@ -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;
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 32385c424789ed416d3e515ec58794b3104e3927..871a2149c883241f64292fd24bae4767f6eacf7e 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -612,10 +612,7 @@
 
 			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({
diff --git a/apps/files_external/js/app.js b/apps/files_external/js/app.js
index bf853f926dcf969bff35e634e7aa92df40acf79e..1bff3014bd663e9cd6e7052b5f55bf0ce9ec71e8 100644
--- a/apps/files_external/js/app.js
+++ b/apps/files_external/js/app.js
@@ -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;
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
index 3168e930829b0d3d24bccc64fd657fef3eb512ec..af198208de2b5584c12f617b6d2d4c0e1e8d9355 100644
--- a/apps/files_sharing/js/app.js
+++ b/apps/files_sharing/js/app.js
@@ -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;
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js
index 1f46f568bf2fadd60f7071139316b33935a3dd26..600a8ce2b03d03f01c753f371489cce126163d73 100644
--- a/apps/files_trashbin/js/app.js
+++ b/apps/files_trashbin/js/app.js
@@ -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');