Ignore stored-file path with no 'storage:'
There was a report of an imported file with a relative path, probably from some ancient bug (in our code or a plugin's)
This commit is contained in:
parent
126fb86957
commit
d3833b8afd
1 changed files with 8 additions and 6 deletions
|
@ -2209,9 +2209,10 @@ Zotero.Item.prototype.getFilePath = function () {
|
||||||
// Imported file with relative path
|
// Imported file with relative path
|
||||||
if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
|
if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
|
||||||
linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) {
|
linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) {
|
||||||
if (path.indexOf("storage:") == -1) {
|
if (!path.includes("storage:")) {
|
||||||
Zotero.debug("Invalid attachment path '" + path + "'", 2);
|
Zotero.logError("Invalid attachment path '" + path + "'");
|
||||||
throw new Error("Invalid path");
|
this._updateAttachmentStates(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
// Strip "storage:"
|
// Strip "storage:"
|
||||||
path = path.substr(8);
|
path = path.substr(8);
|
||||||
|
@ -2294,9 +2295,10 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () {
|
||||||
// Imported file with relative path
|
// Imported file with relative path
|
||||||
if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
|
if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL ||
|
||||||
linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) {
|
linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) {
|
||||||
if (path.indexOf("storage:") == -1) {
|
if (!path.includes("storage:")) {
|
||||||
Zotero.debug("Invalid attachment path '" + path + "'", 2);
|
Zotero.logError("Invalid attachment path '" + path + "'");
|
||||||
throw new Error("Invalid path");
|
this._updateAttachmentStates(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip "storage:"
|
// Strip "storage:"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue