diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 395b2a53c1000b7fc5e8d9506ec7a1b47adeb23d..1438fc504e6056296dbd4038da41b1a667b9308f 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -130,6 +130,8 @@
 		 * @return true if the file name is valid.
 		 * Throws a string exception with an error message if
 		 * the file name is not valid
+		 *
+		 * NOTE: This function is duplicated in the filepicker inside core/src/OC/dialogs.js
 		 */
 		isFileNameValid: function (name) {
 			var trimmedName = name.trim();
diff --git a/core/js/dist/login.js b/core/js/dist/login.js
index 79ef9c1337ce4706b65dce1543ec72b580ddfab8..10b5912236b3fd513fc69a1ed2ff76a13b464c17 100644
Binary files a/core/js/dist/login.js and b/core/js/dist/login.js differ
diff --git a/core/js/dist/login.js.map b/core/js/dist/login.js.map
index 6104a1e70b4a2baf1765a2b3027751397f90bdc7..0052b5d87065ae36806b2a3b2a44305e039192c7 100644
Binary files a/core/js/dist/login.js.map and b/core/js/dist/login.js.map differ
diff --git a/core/js/dist/main.js b/core/js/dist/main.js
index 3656f87eba3a7c7d87aa52c37e7850daf2e092fd..43d012a0ff7db410dfd8cf4bf54cdd6460b0dcd9 100644
Binary files a/core/js/dist/main.js and b/core/js/dist/main.js differ
diff --git a/core/js/dist/main.js.map b/core/js/dist/main.js.map
index cbe803bfad3384331431f10477ca1040d3aaa783..ae965ab93d0eb7557ad14f47c53a4af05e4a8acb 100644
Binary files a/core/js/dist/main.js.map and b/core/js/dist/main.js.map differ
diff --git a/core/js/dist/maintenance.js b/core/js/dist/maintenance.js
index 0f342d985f3103339ef17c4eeb2a8c400d8b8c2c..b037a1b579a732372a441777be23048b08c87ee7 100644
Binary files a/core/js/dist/maintenance.js and b/core/js/dist/maintenance.js differ
diff --git a/core/js/dist/maintenance.js.map b/core/js/dist/maintenance.js.map
index cf211341d20766bbc64ece69e6435af9567757fa..848114339f25d88908038ccb4050caf73cbe7b8f 100644
Binary files a/core/js/dist/maintenance.js.map and b/core/js/dist/maintenance.js.map differ
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js
index e9ffb5a6a1558609d9994f7771c78ff992dfbb15..cea857f6f2ef27c1f5670895ac5295d92d12c96e 100644
--- a/core/src/OC/dialogs.js
+++ b/core/src/OC/dialogs.js
@@ -336,11 +336,39 @@ const Dialogs = {
 				$form.submit()
 			})
 
+
+			/**
+			 * Checks whether the given file name is valid.
+			 *
+			 * @param name file name to check
+			 * @return true if the file name is valid.
+			 * @throws a string exception with an error message if
+			 * the file name is not valid
+			 *
+			 * NOTE: This function is duplicated in the files app:
+			 * https://github.com/nextcloud/server/blob/b9bc2417e7a8dc81feb0abe20359bedaf864f790/apps/files/js/files.js#L127-L148
+			 */
+			var isFileNameValid = function (name) {
+				var trimmedName = name.trim();
+				if (trimmedName === '.' || trimmedName === '..')
+				{
+					throw t('files', '"{name}" is an invalid file name.', {name: name})
+				} else if (trimmedName.length === 0) {
+					throw t('files', 'File name cannot be empty.')
+				} else if (trimmedName.indexOf('/') !== -1) {
+					throw t('files', '"/" is not allowed inside a file name.')
+				} else if (!!(trimmedName.match(OC.config.blacklist_files_regex))) {
+					throw t('files', '"{name}" is not an allowed filetype', {name: name})
+				}
+
+				return true
+			}
+
 			var checkInput = function() {
 				var filename = $input.val()
 				try {
-					if (!Files.isFileNameValid(filename)) {
-						// Files.isFileNameValid(filename) throws an exception itself
+					if (!isFileNameValid(filename)) {
+						// isFileNameValid(filename) throws an exception itself
 					} else if (self.filelist.find(function(file) {
 						return file.name === this
 					}, filename)) {