Fix shared folder duplication bug

pull/1/head
yflory 5 years ago
parent 51b1c19e77
commit efded1063f

@ -4461,8 +4461,7 @@ define([
className: 'primary',
name: Messages.forgetButton,
onClick: function () {
manager.delete([['sharedFoldersTemp', fId]], function () {
});
manager.delete([['sharedFoldersTemp', fId]], function () { });
},
keys: []
}, {
@ -4478,8 +4477,12 @@ define([
};
if (typeof (deprecated) === "object") {
Object.keys(deprecated).forEach(function (fId) {
var data = deprecated[fId];
var sfId = manager.user.userObject.getSFIdFromHref(data.href);
if (folders[fId] || sfId) { // This shared folder is already stored in the drive...
return void manager.delete([['sharedFoldersTemp', fId]], function () { });
}
nt = nt(function (waitFor) {
var data = deprecated[fId];
UI.openCustomModal(passwordModal(fId, data, waitFor()));
}).nThen;
});

@ -734,10 +734,6 @@ define([
var fixSharedFolders = function () {
if (sharedFolder) { return; }
if (typeof(files[SHARED_FOLDERS]) !== "object") { debug("SHARED_FOLDER was not an object"); files[SHARED_FOLDERS] = {}; }
if (typeof(files[SHARED_FOLDERS_TEMP]) !== "object") {
debug("SHARED_FOLDER_TEMP was not an object");
files[SHARED_FOLDERS_TEMP] = {};
}
var sf = files[SHARED_FOLDERS];
var rootFiles = exp.getFiles([ROOT]);
var root = exp.find([ROOT]);
@ -762,6 +758,21 @@ define([
}
}
};
var fixSharedFoldersTemp = function () {
if (sharedFolder) { return; }
if (typeof(files[SHARED_FOLDERS_TEMP]) !== "object") {
debug("SHARED_FOLDER_TEMP was not an object");
files[SHARED_FOLDERS_TEMP] = {};
}
// Remove deprecated shared folder if they were already added back
var sft = files[SHARED_FOLDERS_TEMP];
var sf = files[SHARED_FOLDERS];
for (var id in sft) {
if (sf[id]) {
delete sft[id];
}
}
};
var fixDrive = function () {
@ -776,6 +787,7 @@ define([
fixFilesData();
fixDrive();
fixSharedFolders();
fixSharedFoldersTemp();
if (JSON.stringify(files) !== before) {
debug("Your file system was corrupted. It has been cleaned so that the pads you visit can be stored safely");

Loading…
Cancel
Save