From 3014840d6b5bb6e876cf161dbf5d09aa89eb9b16 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 30 Dec 2025 14:46:49 -0300 Subject: [PATCH 1/2] fix: add fallback to window.open in EnvelopeFilesList viewer - Move URL generation outside conditional to avoid duplication - Add fallback to window.open() when OCA.Viewer is unavailable - Simplify reference from window.OCA to OCA for consistency - Ensures PDFs can be opened directly if Viewer app fails Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- src/Components/RightSidebar/EnvelopeFilesList.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Components/RightSidebar/EnvelopeFilesList.vue b/src/Components/RightSidebar/EnvelopeFilesList.vue index b2e3e017a6..0264fdca98 100644 --- a/src/Components/RightSidebar/EnvelopeFilesList.vue +++ b/src/Components/RightSidebar/EnvelopeFilesList.vue @@ -362,19 +362,20 @@ export default { return url.toString() }, openFile(file) { - if (window.OCA?.Viewer !== undefined) { + const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid }) + if (OCA?.Viewer !== undefined) { const fileInfo = { - source: generateUrl('/apps/libresign/p/pdf/{uuid}', { - uuid: file.uuid, - }), + source: fileUrl, basename: file.name, mime: 'application/pdf', fileid: file.nodeId, } - window.OCA.Viewer.open({ + OCA.Viewer.open({ fileInfo, list: [fileInfo], }) + } else { + window.open(`${fileUrl}?_t=${Date.now()}`) } }, isSelected(fileId) { From 39d080575bd467b12ad8ad78f26336da4c08b9a9 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 30 Dec 2025 14:46:56 -0300 Subject: [PATCH 2/2] fix: optimize viewFile method in EnvelopeValidation - Move URL generation outside conditional to avoid code duplication - Ensures URL is generated once and reused for both viewer and fallback - Maintains fallback to window.open() when OCA.Viewer is unavailable Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- src/components/validation/EnvelopeValidation.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/validation/EnvelopeValidation.vue b/src/components/validation/EnvelopeValidation.vue index fdeff07789..d332d58a94 100644 --- a/src/components/validation/EnvelopeValidation.vue +++ b/src/components/validation/EnvelopeValidation.vue @@ -247,8 +247,8 @@ export default { return n('libresign', '{progress} of {total} document signed', '{progress} of {total} documents signed', total, { progress, total }) }, viewFile(file) { + const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid }) if (OCA?.Viewer !== undefined) { - const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid }) const fileInfo = { source: fileUrl, basename: file.name, @@ -260,7 +260,6 @@ export default { list: [fileInfo], }) } else { - const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid }) window.open(`${fileUrl}?_t=${Date.now()}`) } },