diff --git a/packages/web-app-pdf-viewer/src/App.vue b/packages/web-app-pdf-viewer/src/App.vue index 80c0d336260..1a72ccdbb72 100644 --- a/packages/web-app-pdf-viewer/src/App.vue +++ b/packages/web-app-pdf-viewer/src/App.vue @@ -47,7 +47,9 @@ export default defineComponent({ try { this.loading = true this.resource = await this.getFileResource(fileContext.path) - this.url = await this.getUrlForResource(this.resource) + this.url = await this.getUrlForResource(this.resource, { + disposition: 'inline' + }) } catch (e) { this.loadingError = true console.error('Error fetching pdf', e) diff --git a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts index d70de1a3d3c..747123efc9f 100644 --- a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts +++ b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts @@ -32,11 +32,13 @@ export function useAppFileHandling({ const getUrlForResource = async ( { webDavPath, downloadURL }: Resource, - options: { signUrlTimeout?: number } = {} + options: { disposition?: 'inline' | 'attachment', signUrlTimeout?: number } = {} ) => { const signUrlTimeout = options.signUrlTimeout || 86400 + const inlineDisposition = (options.disposition || 'attachment') === 'inline' + let signed = true - if (!downloadURL) { + if (!downloadURL && !inlineDisposition) { // TODO: check whether we can fix the resource to always contain public-files in the webDavPath let urlPath if (unref(isPublicLinkContext)) { @@ -66,7 +68,7 @@ export function useAppFileHandling({ // const combinedQuery = [queryStr, signedQuery].filter(Boolean).join('&') // downloadURL = [url, combinedQuery].filter(Boolean).join('?') - if (!signed) { + if (!signed || inlineDisposition) { const response = await getFileContents(webDavPath, { responseType: 'blob' })