Skip to content

Conversation

@gluck243
Copy link
Contributor

@gluck243 gluck243 commented Jan 27, 2026

User description

The FileNameCleaner logic supports replacing colons and double quotes with underscores to ensure valid Windows filenames. However, the FileNameCleanerTest was missing explicit test cases for these characters. This PR adds those missing cases.

Steps to test

  1. Open jablib/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java
  2. Run the tests.
  3. Verify that cleanFileName passes for inputs containing : and ".

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

Tests


Description

  • Adds missing test cases for Windows filename characters

  • Tests colon (:) character replacement with underscore

  • Tests double quote (") character replacement with underscore


Diagram Walkthrough

flowchart LR
  A["FileNameCleanerTest"] -->|adds test cases| B["Colon character handling"]
  A -->|adds test cases| C["Double quote character handling"]
  B -->|verifies| D["file:with:colon.txt → file_with_colon.txt"]
  C -->|verifies| E["file\"with\"quote.txt → file_with_quote.txt"]
Loading

File Walkthrough

Relevant files
Tests
FileNameCleanerTest.java
Add Windows filename edge case test coverage                         

jablib/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java

  • Adds two new parameterized test cases to cleanFileName method
  • Tests replacement of colons (:) with underscores in filenames
  • Tests replacement of double quotes (") with underscores in filenames
  • Ensures Windows filename compatibility for these special characters
+3/-1     

@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Jan 27, 2026

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: Robust Error Handling and Edge Case Management

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

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: Security-First Input Validation and Data Handling

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

Status: Passed

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

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

@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Jan 27, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Add test case for backslashes
Suggestion Impact:The suggestion was directly implemented. The commit adds the exact test case suggested: a parameterized test entry for backslash handling in filenames, with the expected cleaned filename "file_with_backslash.txt" and input "file\with\backslash.txt".

code diff:

+            "file_with_quote.txt, file\"with\"quote.txt",
+            "file_with_backslash.txt, file\\with\\backslash.txt"

Add a parameterized test case to verify that backslashes (</code>) are correctly
handled as illegal characters in filenames.

jablib/src/test/java/org/jabref/logic/util/FileNameCleanerTest.java [18-20]

 "'The Evolution of Sentiment_ Analysis_A Review of Research Topics, Venues, and Top Cited Papers.PDF', 'The Evolution of Sentiment} Analysis}A Review of Research Topics, Venues, and Top Cited Papers.PDF'",
 "file_with_colon.txt, file:with:colon.txt",
-"file_with_quote.txt, file\"with\"quote.txt"
+"file_with_quote.txt, file\"with\"quote.txt",
+"file_with_backslash.txt, file\\with\\backslash.txt"

[Suggestion processed]

Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies a missing test case for the backslash character (\), which is also an illegal filename character on Windows, thereby improving the test suite's completeness.

Low
  • Update

@Siedlerchr
Copy link
Member

Thanks for your PR! Looks good to me!

@Siedlerchr Siedlerchr added this pull request to the merge queue Jan 27, 2026
@github-actions github-actions bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Jan 27, 2026
Merged via the queue into JabRef:main with commit 7a797c6 Jan 27, 2026
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review effort 1/5 status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants