Skip to content

Commit 2cb8aea

Browse files
committed
fix(Album): Do not close the form on rename error
Signed-off-by: Louis Chmn <louis@chmn.me>
1 parent 045ce9d commit 2cb8aea

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/components/Albums/AlbumForm.vue

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ export default {
164164
}
165165
166166
switch (error.reason) {
167-
case InvalidFilenameErrorReason.Character:
168-
return t('files', '"{char}" is not allowed inside a filename.', { char: error.segment })
169-
case InvalidFilenameErrorReason.ReservedName:
170-
return undefined // We don't need to enforce that for albums.
171-
case InvalidFilenameErrorReason.Extension:
172-
return undefined // We don't need to enforce that for albums.
173-
default:
174-
return t('files', 'Invalid filename.')
167+
case InvalidFilenameErrorReason.Character:
168+
return t('files', '"{char}" is not allowed inside a filename.', { char: error.segment })
169+
case InvalidFilenameErrorReason.ReservedName:
170+
return undefined // We don't need to enforce that for albums.
171+
case InvalidFilenameErrorReason.Extension:
172+
return undefined // We don't need to enforce that for albums.
173+
default:
174+
return t('files', 'Invalid filename.')
175175
}
176176
}
177177
@@ -256,6 +256,10 @@ export default {
256256
257257
if (this.album.basename !== this.albumName) {
258258
album = await this.renameCollection({ collectionFileName: this.album.filename, newBaseName: this.albumName })
259+
260+
if (album === this.album) {
261+
return // Abort, and do not close the form if renaming failed
262+
}
259263
}
260264
261265
if (this.album.location !== this.albumLocation) {
@@ -303,7 +307,8 @@ export default {
303307
justify-content: space-between;
304308
flex-direction: column;
305309
306-
.left-buttons, .right-buttons {
310+
.left-buttons,
311+
.right-buttons {
307312
display: flex;
308313
gap: calc(var(--default-grid-baseline) * 4);
309314
}

0 commit comments

Comments
 (0)