From 8dd1246341558cebcd9d7c738f7aeda0bbf9b335 Mon Sep 17 00:00:00 2001 From: Andrew Backhouse Date: Thu, 21 May 2026 18:39:32 +0200 Subject: [PATCH 1/2] fix(SaveAs): improve filename validation, fix cant-empty-field bug, prefill path where available Signed-off-by: Andrew Backhouse --- src/components/Modal/SaveAs.vue | 19 +++++++++++++++++-- src/document.js | 6 +++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/Modal/SaveAs.vue b/src/components/Modal/SaveAs.vue index d033f5216b..8b8f6fb6d8 100644 --- a/src/components/Modal/SaveAs.vue +++ b/src/components/Modal/SaveAs.vue @@ -19,6 +19,7 @@ {{ t('richdocuments', 'Cancel') }} {{ t('richdocuments', 'Save') }} @@ -66,13 +67,13 @@ export default { emits: ['close'], data() { return { - selectedPath: '', + selectedPath: null, } }, computed: { newFileName: { get() { - if (this.selectedPath !== '') { + if (this.selectedPath !== null) { return this.selectedPath } const filename = this.path @@ -84,6 +85,20 @@ export default { this.selectedPath = value }, }, + isValidName() { + const value = this.newFileName.trim() + if (value === '') { + return false + } + const base = value.split('/').pop() + const parts = base.split('.') + let valid = true + // filename is non-empty + valid &&= base !== '' + // filename has both a name part and an extension + valid &&= parts.length >= 2 && parts.at(-2).length > 0 && parts.at(-1).length > 0 + return valid + }, }, mounted() { // prepare filename for having a separate picker for the path (.split('/').pop()) diff --git a/src/document.js b/src/document.js index 351886b1d4..2dcf0c32ef 100644 --- a/src/document.js +++ b/src/document.js @@ -470,10 +470,14 @@ const documentsMain = { } if (msgId === 'UI_SaveAs') { + let docPath = documentsMain.fileName + if (documentsMain.fullPath && documentsMain.fullPath !== '/') { + docPath = documentsMain.fullPath + } spawnDialog( SaveAs, { - path: documentsMain.fileName, + path: docPath, format: args.format, }, (value) => value && PostMessages.sendWOPIPostMessage('loolframe', 'Action_SaveAs', { Filename: value, Notify: true }), From 2347aaf484cd32a96ebf971fa6021c583ef684db Mon Sep 17 00:00:00 2001 From: Elizabeth Danzberger Date: Fri, 5 Jun 2026 16:02:04 -0400 Subject: [PATCH 2/2] test(SaveAs): use full path Signed-off-by: Elizabeth Danzberger --- cypress/e2e/direct.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/direct.spec.js b/cypress/e2e/direct.spec.js index 902eb74511..d4ce2232e0 100644 --- a/cypress/e2e/direct.spec.js +++ b/cypress/e2e/direct.spec.js @@ -183,7 +183,7 @@ describe('Direct editing (legacy)', function() { .should('be.visible') cy.get('.saveas-dialog input[type=text]') .should('be.visible') - .should('have.value', 'document.rtf') + .should('have.value', '/document.rtf') cy.get('.saveas-dialog button.button-vue--vue-primary').click()