diff options
author | Jonas <jonas@freesources.org> | 2024-06-04 15:48:34 +0200 |
---|---|---|
committer | Jonas <jonas@freesources.org> | 2024-06-04 15:56:23 +0200 |
commit | f3cd03b141f7ee27ba0e71b9cdcaad0bb3ef9bf9 (patch) | |
tree | 2c09a1e5b9390ab7b5c01d4e603710b64ebcdf99 | |
parent | 3663c4a719be285669d7c1198e20646cf6581dd4 (diff) | |
download | nextcloud-server-f3cd03b141f7ee27ba0e71b9cdcaad0bb3ef9bf9.tar.gz nextcloud-server-f3cd03b141f7ee27ba0e71b9cdcaad0bb3ef9bf9.zip |
fix(dialogs): Make sure conflict dialog is loaded before adding conflicts
Fixes a possible race condition where conflicts are added and the dialog
loading finishes only afterwards.
The race condition sometimes led to missing files in the conflict dialog
when uploading several existing files at once.
Fixes: #45661
-rw-r--r-- | core/src/OC/dialogs.js | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index ad501ee0628..ef62b7ad6a8 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -918,27 +918,28 @@ const Dialogs = { var dialogName = 'oc-dialog-fileexists-content' var dialogId = '#' + dialogName if (this._fileexistsshown) { - // add conflict - - var $conflicts = $(dialogId + ' .conflicts') - addConflict($conflicts, original, replacement) - - var count = $(dialogId + ' .conflict').length - var title = n('core', - '{count} file conflict', - '{count} file conflicts', - count, - { count: count } - ) - $(dialogId).parent().children('.oc-dialog-title').text(title) - - // recalculate dimensions - $(window).trigger('resize') - dialogDeferred.resolve() + this._fileexistsshown.then(() => { + // add conflict + + var $conflicts = $(dialogId + ' .conflicts') + addConflict($conflicts, original, replacement) + + var count = $(dialogId + ' .conflict').length + var title = n('core', + '{count} file conflict', + '{count} file conflicts', + count, + { count: count } + ) + $(dialogId).parent().children('.oc-dialog-title').text(title) + + // recalculate dimensions + $(window).trigger('resize') + dialogDeferred.resolve() + }) } else { // create dialog - this._fileexistsshown = true - $.when(this._getFileExistsTemplate()).then(function($tmpl) { + this._fileexistsshown = $.when(this._getFileExistsTemplate()).then(function($tmpl) { var title = t('core', 'One file conflict') var $dlg = $tmpl.octemplate({ dialog_name: dialogName, |