Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the cleanup renaming which will only rename ".pdf" files. #12396

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/logic/cleanup/RenamePdfCleanup.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public RenamePdfCleanup(boolean onlyRelativePaths, Supplier<BibDatabaseContext>
this.filePreferences = filePreferences;
}

private boolean allowedFileType(String filePath) {
String lowerCase = filePath.toLowerCase();

return lowerCase.endsWith(".pdf");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

public static boolean isPDFFile(Path file) {

}

@Override
public List<FieldChange> cleanup(BibEntry entry) {
List<LinkedFile> files = entry.getFiles();
Expand All @@ -41,6 +47,10 @@ public List<FieldChange> cleanup(BibEntry entry) {
if (onlyRelativePaths && Path.of(file.getLink()).isAbsolute()) {
continue;
}
if (!allowedFileType(file.getLink())) {
LOGGER.info("Skipping renaming: {}", file.getLink());
continue;
}

LinkedFileHandler fileHandler = new LinkedFileHandler(file, entry, databaseContext.get(), filePreferences);
try {
Expand Down
Loading