aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/Util/get-url-parameter.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Util/get-url-parameter.js')
-rw-r--r--core/src/Util/get-url-parameter.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/Util/get-url-parameter.js b/core/src/Util/get-url-parameter.js
new file mode 100644
index 00000000000..6df264f009f
--- /dev/null
+++ b/core/src/Util/get-url-parameter.js
@@ -0,0 +1,14 @@
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+/**
+ * @param {any} name -
+ */
+export default function getURLParameter(name) {
+ return decodeURIComponent(
+ // eslint-disable-next-line no-sparse-arrays
+ (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ''])[1].replace(/\+/g, '%20'),
+ ) || ''
+}