Show file access error for NS_ERROR_FILE_FS_CORRUPTED

Windows returns this for ERROR_FILE_CORRUPT/ERROR_DISK_CORRUPT. It's not
in xpc.msg, so the exception has an empty name and isn't in
Components.results, and it was falling through to the generic file sync
error instead of the file access error with the path. Show a message
about the reported corruption in place of the usual permissions advice.

https://forums.zotero.org/discussion/133592/
This commit is contained in:
Dan Stillman 2026-09-04 11:20:06 -04:00
parent e3da52bebc
commit f3810befde
2 changed files with 16 additions and 3 deletions

View file

@ -1727,16 +1727,27 @@ Zotero.File = new function () {
if (e.name == 'NS_ERROR_FILE_ACCESS_DENIED' || e.name == 'NS_ERROR_FILE_IS_LOCKED'
// These show up on some Windows systems
|| e.name == 'NS_ERROR_FAILURE' || e.name == 'NS_ERROR_FILE_NOT_FOUND'
// NS_ERROR_FILE_FS_CORRUPTED (Windows ERROR_FILE_CORRUPT/ERROR_DISK_CORRUPT), which
// isn't in Components.results or exposed as an exception name
|| e.result == 0x80520016
// OS.File.Error
|| e.becauseAccessDenied || e.becauseNoSuchFile
// IOUtils
|| e.name == 'NotAllowedError'
|| e.name == 'ReadOnlyError'
|| e.name == 'NotFoundError') {
let checkFileWindows = Zotero.getString('file.accessError.message.windows');
let checkFileOther = Zotero.getString('file.accessError.message.other');
let checkFile;
if (e.result == 0x80520016) {
checkFile = Zotero.ftl.formatValueSync('file-access-error-fs-corrupted');
}
else if (Zotero.isWin) {
checkFile = Zotero.getString('file.accessError.message.windows');
}
else {
checkFile = Zotero.getString('file.accessError.message.other');
}
let msg = str + "\n\n"
+ (Zotero.isWin ? checkFileWindows : checkFileOther)
+ checkFile
+ "\n\n"
+ Zotero.getString('file.accessError.restart');

View file

@ -362,6 +362,8 @@ item-button-view-online =
file-renaming-file-renamed-to = File renamed to { $filename }
file-access-error-fs-corrupted = { -os-name } reported that the file or disk is corrupted. Run a disk check on the drive containing the file.
itembox-button-options =
.tooltiptext = Open context menu
itembox-button-merge =