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 b0a6e06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
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 b0a6e06

Please sign in to comment.