Skip to content

Commit

Permalink
fix force delete bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyChen777 committed Jun 24, 2022
1 parent 17f7c41 commit 3928b41
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3928b41

Please sign in to comment.