Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions js/photos-dashboard.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-dashboard.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/store/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,19 @@ 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] })
await client.moveFile(collection.filename, newCollection.filename, { overwrite: false })
await client.moveFile(collection.filename, newCollection.filename)
context.commit('removeCollections', { collectionFileNames: [collectionFileName] })
return newCollection
} catch (error) {
Expand Down
Loading