diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-01-19 16:38:51 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-01-28 12:00:20 +0100 |
commit | 4f90766ba314171bbfc78d1e988307c50633e7f3 (patch) | |
tree | f5f910ff0f3dd2ff8fa5a05c8fd1f905ffc21ba5 /apps/files/src/utils/davUtils.js | |
parent | 7e6d69d166cbc92fb457fc72efc9abe850a0bbe4 (diff) | |
download | nextcloud-server-4f90766ba314171bbfc78d1e988307c50633e7f3.tar.gz nextcloud-server-4f90766ba314171bbfc78d1e988307c50633e7f3.zip |
Skip template picker if none available
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/src/utils/davUtils.js')
-rw-r--r-- | apps/files/src/utils/davUtils.js | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/files/src/utils/davUtils.js b/apps/files/src/utils/davUtils.js index f64801f08dd..cd5732a4772 100644 --- a/apps/files/src/utils/davUtils.js +++ b/apps/files/src/utils/davUtils.js @@ -23,7 +23,7 @@ import { generateRemoteUrl } from '@nextcloud/router' import { getCurrentUser } from '@nextcloud/auth' -const getRootPath = function() { +export const getRootPath = function() { if (getCurrentUser()) { return generateRemoteUrl(`dav/files/${getCurrentUser().uid}`) } else { @@ -31,12 +31,22 @@ const getRootPath = function() { } } -const isPublic = function() { +export const isPublic = function() { return !getCurrentUser() } -const getToken = function() { +export const getToken = function() { return document.getElementById('sharingToken') && document.getElementById('sharingToken').value } -export { getRootPath, getToken, isPublic } +/** + * Return the current directory, fallback to root + * @returns {string} + */ +export const getCurrentDirectory = function() { + const currentDirInfo = OCA?.Files?.App?.currentFileList?.dirInfo + || { path: '/', name: '' } + + // Make sure we don't have double slashes + return `${currentDirInfo.path}/${currentDirInfo.name}`.replace(/\/\//gi, '/') +} |