Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/store/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ const actions = {
filename: collection.filename.replace(new RegExp(`${collection.basename}$`), newBaseName),
}

try {
await client.stat(newCollection.filename)
logger.error(t('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename }), { error: new Error('Target collection already exists') })
showError(t('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename }))
return collection
} catch (error) {
// If the stat fails, it means that the target does not exist yet, so all good.
}

try {
context.commit('addCollections', { collections: [newCollection] })
context.commit('setCollectionFiles', { collectionFileName: newCollection.filename, fileIds: context.state.collectionsFiles[collectionFileName] })
Expand Down
Loading