Skip to content

Commit 129aa68

Browse files
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>
1 parent 34d4967 commit 129aa68

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Components/RightSidebar/EnvelopeFilesList.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,19 +362,20 @@ export default {
362362
return url.toString()
363363
},
364364
openFile(file) {
365-
if (window.OCA?.Viewer !== undefined) {
365+
const fileUrl = generateUrl('/apps/libresign/p/pdf/{uuid}', { uuid: file.uuid })
366+
if (OCA?.Viewer !== undefined) {
366367
const fileInfo = {
367-
source: generateUrl('/apps/libresign/p/pdf/{uuid}', {
368-
uuid: file.uuid,
369-
}),
368+
source: fileUrl,
370369
basename: file.name,
371370
mime: 'application/pdf',
372371
fileid: file.nodeId,
373372
}
374-
window.OCA.Viewer.open({
373+
OCA.Viewer.open({
375374
fileInfo,
376375
list: [fileInfo],
377376
})
377+
} else {
378+
window.open(`${fileUrl}?_t=${Date.now()}`)
378379
}
379380
},
380381
isSelected(fileId) {

0 commit comments

Comments
 (0)