Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: internally resolved public links triggering default action #9587

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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