Skip to content

Revert "Add support for book front covers (#14330)"#14774

Merged
Siedlerchr merged 1 commit into
mainfrom
revert-14330-feature/book-front-cover-10120
Jan 1, 2026
Merged

Revert "Add support for book front covers (#14330)"#14774
Siedlerchr merged 1 commit into
mainfrom
revert-14330-feature/book-front-cover-10120

Conversation

@Siedlerchr

@Siedlerchr Siedlerchr commented Jan 1, 2026

Copy link
Copy Markdown
Member

User description

This reverts commit 0ad7003.

Closes _____

Steps to test

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [.] I manually tested my changes in running JabRef (always required)
  • [.] I added JUnit tests for changes (if applicable)
  • [.] I added screenshots in the PR description (if change is visible to the user)
  • [.] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [.] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

PR Type

Bug fix


Description

  • Removes book cover feature implementation and related code

  • Reverts cover image download functionality from preferences

  • Simplifies file handling by removing cover-related methods

  • Cleans up test utilities and file path operations


Diagram Walkthrough

flowchart LR
  A["Book Cover Feature"] -->|Revert| B["Remove BookCoverFetcher"]
  B --> C["Remove Cover Preferences"]
  C --> D["Simplify File Operations"]
  D --> E["Update Tests"]
Loading

File Walkthrough

Relevant files
Bug fix
18 files
ImportHandler.java
Remove cover-related filename fallback constant                   
+2/-5     
BookCoverFetcher.java
Delete entire book cover fetcher implementation                   
+0/-130 
NewEntryViewModel.java
Remove cover download integration from entry creation       
+2/-17   
JabRefGuiPreferences.java
Remove cover image download preference constant                   
+1/-6     
PreviewTab.java
Remove cover download checkbox from UI                                     
+0/-3     
PreviewTabViewModel.java
Remove cover download property from view model                     
+0/-10   
PreviewPreferences.java
Remove cover download boolean property                                     
+1/-17   
PreviewViewer.java
Remove cover image display from preview rendering               
+23/-38 
ParseLatexDialogViewModel.java
Replace Files API calls with File methods                               
+6/-5     
FileNodeViewModel.java
Replace Files.isDirectory with File.isDirectory                   
+2/-2     
PushApplicationDialogViewModel.java
Replace Files.exists with File.exists                                       
+1/-2     
ThemeDialogViewModel.java
Replace Files.exists with File.exists                                       
+2/-2     
LinkedFileHandler.java
Simplify file naming logic and remove extension handling 
+37/-26 
PushToApplicationDetector.java
Replace Files API with File.exists method                               
+3/-3     
Directories.java
Remove cover directory utility method                                       
+0/-9     
FileUtil.java
Remove URL filename extraction and simplify extension logic
+13/-33 
LinkedFile.java
Remove filename extraction method from linked file             
+0/-21   
PreviewTab.fxml
Remove cover download checkbox from FXML layout                   
+0/-3     
Tests
8 files
AutoRenameFileOnEntryChangeTest.java
Replace custom assertion with standard Files.exists           
+17/-26 
AbstractJabKitTest.java
Remove custom file assertion helper methods                           
+3/-18   
ConvertTest.java
Replace custom assertions with standard file checks           
+6/-5     
JabKitTest.java
Replace custom file assertions with standard checks           
+3/-3     
PseudonymizeTest.java
Replace custom assertions with standard file checks           
+9/-8     
SearchTest.java
Replace custom assertions with standard file checks           
+2/-2     
LinkedFileHandlerTest.java
Update test cases for simplified filename handling             
+34/-58 
FileUtilTest.java
Simplify file extension and basename tests                             
+53/-107
Enhancement
1 files
URLUtil.java
Add filename extraction from URL utility method                   
+16/-0   
Formatting
1 files
FileNameUniqueness.java
Minor formatting adjustment to filename generation             
+3/-1     
Documentation
3 files
CHANGELOG.md
Remove cover image feature from changelog                               
+1/-2     
0040-display-front-cover-in-preview-tab.md
Update image paths in decision document                                   
+4/-4     
JabRef_en.properties
Remove cover image download localization string                   
+0/-2     

@Siedlerchr Siedlerchr merged commit a38679f into main Jan 1, 2026
34 of 53 checks passed
@Siedlerchr Siedlerchr deleted the revert-14330-feature/book-front-cover-10120 branch January 1, 2026 22:25
@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing null validation: The method getFileExtension at line 80 does not validate if fileName parameter is null
before calling lastIndexOf, which could result in NullPointerException.

Referred Code
public static Optional<String> getFileExtension(String fileName) {
    int dotPosition = fileName.lastIndexOf('.');
    if ((dotPosition > 0) && (dotPosition < (fileName.length() - 1))) {
        return Optional.of(fileName.substring(dotPosition + 1).trim().toLowerCase(Locale.ROOT));
    } else {
        return Optional.empty();
    }

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Potential path traversal: The method getFileNameFromUrl at line 161 extracts filename from URL without validating
against path traversal attacks (e.g., '../../../etc/passwd').

Referred Code
public static String getFileNameFromUrl(String url) {
    String fileName = url.substring(url.lastIndexOf('/') + 1);
    if (fileName.isBlank()) {
        fileName = "downloaded.pdf";
    }
    return FileUtil.getValidFileName(fileName);
}

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-free-for-open-source-projects

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Revert introduces inconsistent file handling

The revert introduced inconsistent file and path handling. It replaced efficient
Files.isDirectory(path) calls with the less robust path.toFile().isDirectory()
and introduced new, less robust methods for getting filenames from URLs. These
changes should be reviewed for consistency and correctness.

Examples:

jabgui/src/main/java/org/jabref/gui/texparser/ParseLatexDialogViewModel.java [81-83]
        Predicate<String> isDirectory = path -> Path.of(path).toFile().isDirectory();
        latexDirectoryValidator = new FunctionBasedValidator<>(latexFileDirectory, isDirectory,
                ValidationMessage.error(Localization.lang("Please enter a valid file path.")));
jablib/src/main/java/org/jabref/logic/util/URLUtil.java [161-167]
    public static String getFileNameFromUrl(String url) {
        String fileName = url.substring(url.lastIndexOf('/') + 1);
        if (fileName.isBlank()) {
            fileName = "downloaded.pdf";
        }
        return FileUtil.getValidFileName(fileName);
    }

Solution Walkthrough:

Before:

// In ParseLatexDialogViewModel.java
Predicate<String> isDirectory = path -> Files.isDirectory(Path.of(path));
...
if ((directory == null) || !Files.isDirectory(directory)) { ... }
...
fileListPartition = filesStream.collect(Collectors.partitioningBy(Files::isDirectory));

// In FileUtil.java
public static Optional<String> getFileNameFromUrl(String link) {
    int slash = link.lastIndexOf('/');
    slash = (slash >= 0 ? slash + 1 : 0);
    int query = link.indexOf('?', slash);
    query = (query >= 0 ? query : link.length());
    if (slash < query) {
        return Optional.of(getValidFileName(link.substring(slash, query)));
    } else {
        return Optional.empty();
    }
}

After:

// In ParseLatexDialogViewModel.java
Predicate<String> isDirectory = path -> Path.of(path).toFile().isDirectory();
...
if ((directory == null) || !directory.toFile().isDirectory()) { ... }
...
fileListPartition = filesStream.collect(Collectors.partitioningBy(path -> path.toFile().isDirectory()));

// In URLUtil.java
public static String getFileNameFromUrl(String url) {
    String fileName = url.substring(url.lastIndexOf('/') + 1);
    if (fileName.isBlank()) {
        fileName = "downloaded.pdf";
    }
    return FileUtil.getValidFileName(fileName);
}
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies widespread, subtle, and impactful regressions in file handling logic introduced by the revert, such as replacing efficient Files API calls with less robust File API calls.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant