Better fix for invalid file localUrl in Mendeley DB
This commit is contained in:
parent
3f2ee35d59
commit
d8b2d24524
1 changed files with 5 additions and 1 deletions
|
@ -111,7 +111,7 @@ Zotero_Import_Mendeley.prototype.translate = async function (options) {
|
||||||
// If there's a single PDF file and a single PDF URL and the file exists, make an
|
// If there's a single PDF file and a single PDF URL and the file exists, make an
|
||||||
// imported_url attachment instead of separate file and linked_url attachments
|
// imported_url attachment instead of separate file and linked_url attachments
|
||||||
if (docURLs && docFiles) {
|
if (docURLs && docFiles) {
|
||||||
let pdfFiles = docFiles.filter(x => x.fileURL && x.fileURL.endsWith('.pdf'));
|
let pdfFiles = docFiles.filter(x => x.fileURL.endsWith('.pdf'));
|
||||||
let pdfURLs = docURLs.filter(x => x.includes('pdf'));
|
let pdfURLs = docURLs.filter(x => x.includes('pdf'));
|
||||||
if (pdfFiles.length == 1
|
if (pdfFiles.length == 1
|
||||||
&& pdfURLs.length == 1
|
&& pdfURLs.length == 1
|
||||||
|
@ -462,6 +462,10 @@ Zotero_Import_Mendeley.prototype._getDocumentFiles = async function (groupID) {
|
||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
let docFiles = map.get(row.documentId);
|
let docFiles = map.get(row.documentId);
|
||||||
if (!docFiles) docFiles = [];
|
if (!docFiles) docFiles = [];
|
||||||
|
if (typeof row.localUrl != 'string') {
|
||||||
|
Zotero.debug(`Skipping invalid localUrl '${row.localUrl}' for document ${row.documentId}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
docFiles.push({
|
docFiles.push({
|
||||||
hash: row.hash,
|
hash: row.hash,
|
||||||
fileURL: row.localUrl
|
fileURL: row.localUrl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue