From b0a6e064a7c69bb0978c15af22ed248c4db7f603 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 11 Oct 2022 09:12:37 +0200 Subject: [PATCH] Fix resolving of password protected links --- .../src/composables/tokenInfo/useLoadTokenInfo.ts | 12 +++++++++--- packages/web-runtime/src/pages/resolvePublicLink.vue | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/web-runtime/src/composables/tokenInfo/useLoadTokenInfo.ts b/packages/web-runtime/src/composables/tokenInfo/useLoadTokenInfo.ts index 975d614af0a..ce4ca4e6d34 100644 --- a/packages/web-runtime/src/composables/tokenInfo/useLoadTokenInfo.ts +++ b/packages/web-runtime/src/composables/tokenInfo/useLoadTokenInfo.ts @@ -8,14 +8,20 @@ export function useLoadTokenInfo(token) { const isUserContext = useUserContext({ store }) const loadTokenInfoTask = useTask(function* () { + let tokenInfo + try { if (unref(isUserContext)) { - return yield owncloudSdk.shares.getProtectedTokenInfo(token) + tokenInfo = yield owncloudSdk.shares.getProtectedTokenInfo(token) } else { - return yield owncloudSdk.shares.getUnprotectedTokenInfo(token) + tokenInfo = yield owncloudSdk.shares.getUnprotectedTokenInfo(token) } } catch (e) {} // backend doesn't support the token info endpoint - return {} + return { + ...tokenInfo, + alias_link: tokenInfo.alias_link === 'true', + password_protected: tokenInfo.password_protected === 'true' + } }) return { loadTokenInfoTask } diff --git a/packages/web-runtime/src/pages/resolvePublicLink.vue b/packages/web-runtime/src/pages/resolvePublicLink.vue index 95c6320dd35..eda944eeb24 100644 --- a/packages/web-runtime/src/pages/resolvePublicLink.vue +++ b/packages/web-runtime/src/pages/resolvePublicLink.vue @@ -105,7 +105,7 @@ export default defineComponent({ })) const isPasswordRequiredTask = useTask(function* (signal, ref) { if (!isEmpty(ref.tokenInfo)) { - return ref.tokenInfo.password_protected === 'true' + return ref.tokenInfo.password_protected } try { yield webdav.getFileInfo({ ...unref(publicLinkSpace), publicLinkPassword: null })