diff --git a/packages/preload/repositories/file-repository/backends/local-backend.ts b/packages/preload/repositories/file-repository/backends/local-backend.ts index b513b69e..13c4f87a 100644 --- a/packages/preload/repositories/file-repository/backends/local-backend.ts +++ b/packages/preload/repositories/file-repository/backends/local-backend.ts @@ -58,9 +58,8 @@ export class LocalFileBackend implements FileBackend { try { await fsPromise.copyFile(_sourceURL, _targetURL); if ( - ((this.preference.get("deleteSourceFile") as boolean) && - _sourceURL !== _targetURL) || - forceDelete + ((this.preference.get("deleteSourceFile") as boolean) || forceDelete) && + _sourceURL !== _targetURL ) { await fsPromise.unlink(sourceURL); } diff --git a/packages/preload/repositories/file-repository/backends/webdav-backend.ts b/packages/preload/repositories/file-repository/backends/webdav-backend.ts index 9b177e6d..34950858 100644 --- a/packages/preload/repositories/file-repository/backends/webdav-backend.ts +++ b/packages/preload/repositories/file-repository/backends/webdav-backend.ts @@ -197,17 +197,15 @@ export class WebDavFileBackend implements FileBackend { if (sourceURL.startsWith("file://")) { success = await this._local2localMove(sourceURL, targetCacheURL); success = await this._local2serverMove(sourceURL, targetURL); - if ( - (this.preference.get("deleteSourceFile") as boolean) || - forceDelete - ) { + if (this.preference.get("deleteSourceFile") as boolean) { await fsPromise.unlink(sourceURL); } } else if (sourceURL.startsWith("webdav://")) { success = await this._server2serverMove(sourceURL, targetURL); if ( - (this.preference.get("deleteSourceFile") as boolean) || - forceDelete + ((this.preference.get("deleteSourceFile") as boolean) || + forceDelete) && + sourceURL !== targetURL ) { await this.webdavClient?.deleteFile( sourceURL.replace("webdav://", "/paperlib/") diff --git a/packages/preload/repositories/scraper-repository/scrapers/pdf.ts b/packages/preload/repositories/scraper-repository/scrapers/pdf.ts index e8883777..6cd86546 100644 --- a/packages/preload/repositories/scraper-repository/scrapers/pdf.ts +++ b/packages/preload/repositories/scraper-repository/scrapers/pdf.ts @@ -68,16 +68,16 @@ export class PDFScraper extends Scraper { }; const firstPageText = rawResponse.firstPageText; - entityDraft.setValue("title", metaData.info.Title); + entityDraft.setValue("title", metaData.info.Title || ""); let authors; - if (metaData.info.Author.includes(";")) { + if (metaData.info.Author?.includes(";")) { authors = metaData.info.Author.split(";") .map((author) => { return author.trim(); }) .join(", "); } else { - authors = metaData.info.Author; + authors = metaData.info.Author || ""; } entityDraft.setValue("authors", authors);