Skip to content

Commit

Permalink
fix: internally resolved public links triggering default action (#9587)
Browse files Browse the repository at this point in the history
Fixes an issue where internally resolved public links instantly triggered the default file action. This behavior is not intended to work for public links, even if they resolve into an internal space.
  • Loading branch information
JammingBen authored Aug 23, 2023
1 parent c472d7c commit 4a9a17b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-internal-public-link-resolving
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Internal public link resolving

An issue where internally resolved public links instantly triggered the default file action has been fixed.

https://github.com/owncloud/web/pull/9587
https://github.com/owncloud/web/issues/9578
7 changes: 5 additions & 2 deletions packages/web-app-files/src/views/spaces/DriveResolver.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export default defineComponent({
fileId: resourceId,
path: resourcePath
})
return router.push(
createLocationSpaces('files-spaces-generic', {
params,
Expand All @@ -96,7 +95,11 @@ export default defineComponent({
}
// no internal space found -> share -> resolve via private link as it holds all the necessary logic
return router.push({ name: 'resolvePrivateLink', params: { fileId: unref(fileId) } })
return router.push({
name: 'resolvePrivateLink',
params: { fileId: unref(fileId) },
query: { openWithDefaultApp: 'false' }
})
}
onMounted(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ describe('DriveResolver view', () => {

await wrapper.vm.$nextTick()
expect(mocks.$router.push).toHaveBeenCalledWith(
expect.objectContaining({ name: 'resolvePrivateLink' })
expect.objectContaining({
name: 'resolvePrivateLink',
query: { openWithDefaultApp: 'false' }
})
)
})
})
Expand Down
10 changes: 7 additions & 3 deletions packages/web-runtime/src/pages/resolvePrivateLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default defineComponent({
const clientService = useClientService()
const openWithDefaultAppQuery = useRouteQuery('openWithDefaultApp')
const openWithDefaultApp = computed(() => queryItemAsString(unref(openWithDefaultAppQuery)))
const detailsQuery = useRouteQuery('details')
const details = computed(() => {
return queryItemAsString(unref(detailsQuery))
Expand Down Expand Up @@ -163,9 +166,10 @@ export default defineComponent({
? matchingSpace.shareId
: unref(resource).fileId,
...(unref(details) && { details: unref(details) }),
...(configurationManager.options.openLinksWithDefaultApp && {
openWithDefaultApp: 'true'
})
...(configurationManager.options.openLinksWithDefaultApp &&
unref(openWithDefaultApp) !== 'false' && {
openWithDefaultApp: 'true'
})
}
}
router.push(location)
Expand Down

0 comments on commit 4a9a17b

Please sign in to comment.