Skip to content

Commit

Permalink
Fix resolving of password protected links
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Oct 11, 2022
1 parent a73cfba commit 190685f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions packages/web-runtime/src/composables/tokenInfo/useLoadTokenInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ 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 {}
} 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 }
Expand Down
2 changes: 1 addition & 1 deletion packages/web-runtime/src/pages/resolvePublicLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 190685f

Please sign in to comment.