- Display more helpful message for "(NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.remove]" error when a remotely modified file is in use locally on Windows
- Fix a potential NS_ERROR_TARGET_FILE_EXISTS error from a recent commit - Fix alignment of sync error icon
This commit is contained in:
parent
9707464e05
commit
83781293da
4 changed files with 28 additions and 6 deletions
|
@ -57,6 +57,11 @@
|
|||
-moz-padding-start: 8px;
|
||||
}
|
||||
|
||||
#zotero-tb-sync-warning[error=true]
|
||||
{
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.zotero-tb-button[open="true"] > .toolbarbutton-icon,
|
||||
.zotero-tb-button:hover:active > .toolbarbutton-icon,
|
||||
#zotero-pane-stack[fullscreenmode="true"] #zotero-tb-fullscreen > .toolbarbutton-icon {
|
||||
|
|
|
@ -888,8 +888,7 @@ Zotero.Sync.Storage = new function () {
|
|||
destFile.QueryInterface(Components.interfaces.nsILocalFile);
|
||||
destFile.setRelativeDescriptor(parentDir, fileName);
|
||||
if (destFile.exists()) {
|
||||
var msg = "ZIP entry '" + fileName + "' "
|
||||
+ " already exists";
|
||||
var msg = "ZIP entry '" + fileName + "' " + "already exists";
|
||||
Zotero.debug(msg, 2);
|
||||
Components.utils.reportError(msg + " in " + funcName);
|
||||
continue;
|
||||
|
@ -984,7 +983,22 @@ Zotero.Sync.Storage = new function () {
|
|||
|
||||
if (file.isFile()) {
|
||||
Zotero.debug("Deleting existing file " + file.leafName);
|
||||
file.remove(false);
|
||||
try {
|
||||
file.remove(false);
|
||||
}
|
||||
catch (e) {
|
||||
if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED') {
|
||||
Zotero.debug(e);
|
||||
|
||||
// TODO: localize
|
||||
var msg = "The file '" + file.leafName + "' is in use and cannot "
|
||||
+ "be updated. Please close the file or restart your computer "
|
||||
+ "and try syncing again.";
|
||||
throw (msg);
|
||||
}
|
||||
|
||||
throw (e);
|
||||
}
|
||||
}
|
||||
else if (file.isDirectory()) {
|
||||
Zotero.debug("Deleting existing directory " + file.leafName);
|
||||
|
|
|
@ -190,6 +190,11 @@ Zotero.Sync.Storage.Session.ZFS.prototype.downloadFile = function (request) {
|
|||
else {
|
||||
destFile.append(item.key + '.tmp');
|
||||
}
|
||||
|
||||
if (destFile.exists()) {
|
||||
destFile.remove(false);
|
||||
}
|
||||
|
||||
// saveURI() below appears not to create empty files for Content-Length: 0,
|
||||
// so we create one here just in case
|
||||
destFile.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||
|
@ -252,8 +257,7 @@ Zotero.Sync.Storage.Session.ZFS.prototype.downloadFile = function (request) {
|
|||
var wbp = Components
|
||||
.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
|
||||
.createInstance(nsIWBP);
|
||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE
|
||||
| nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
|
||||
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
|
||||
wbp.progressListener = listener;
|
||||
wbp.saveURI(uri, null, null, null, null, destFile);
|
||||
}
|
||||
|
|
|
@ -221,7 +221,6 @@
|
|||
#zotero-tb-sync-warning[error=true]
|
||||
{
|
||||
list-style-image: url(chrome://zotero/skin/exclamation.png);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
#zotero-tb-sync {
|
||||
|
|
Loading…
Reference in a new issue