Fix IllegalCharacterException when downloading pdfs with links having :#14977
Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
Signed-off-by: subhramit <subhramit.bb@live.in>
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
IllegalCharacterException when downloading pdfs with links having :
User description
Fixes #14975
Steps to test
Try to add the entry
to a library.
It should add successfully now.
Before:


and the entry would not be added (or visible in the library)
Now:
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Bug fix
Description
Fix IllegalCharacterException when processing URLs with colons
Extract filename from URL path before getting file extension
Add tests for online links and URL path handling
Update changelog with issue reference
Diagram Walkthrough
flowchart LR A["LinkedFile with URL"] --> B{"Is Online Link?"} B -->|Yes| C["Extract filename from URL"] C --> D["Get file extension"] B -->|No| E["Get extension directly"] D --> F["Determine file type"] E --> F F --> G["Return ExternalFileType"]File Walkthrough
ExternalFileTypes.java
Handle URL paths separately for extension detectionjabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java
FileUtil.getFileNameFromUrl()to avoid InvalidPathException
ExternalFileTypesTest.java
Add tests for online link file type detectionjabgui/src/test/java/org/jabref/gui/externalfiletype/ExternalFileTypesTest.java
CHANGELOG.md
Document URL colon handling fixCHANGELOG.md