Skip to content

Commit

Permalink
Merge pull request #9906 from JabRef/enable-mendeley-path-parsing
Browse files Browse the repository at this point in the history
Support for $\backslash$ in file paths
  • Loading branch information
Siedlerchr committed May 16, 2023
2 parents 0247913 + 743cedd commit 228ce99
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We enabled scrolling in the groups list when dragging a group on another group. [#2869](https://github.com/JabRef/jabref/pull/2869)
- We added the option to automatically download online files when a new entry is created from an existing ID (e.g. DOI). The option can be disabled in the preferences under "Import and Export". [#9756](https://github.com/JabRef/jabref/issues/9756)
- We added a new Integrity check for unscaped ampersands. [koppor#585](https://github.com/koppor/jabref/issues/585)
- We added support for parsing `$\backslash$` in file paths (as exported by Mendeley). [forum#3470](https://discourse.jabref.org/t/mendeley-bib-import-with-linked-files/3470)
- We added the possibility to automatically fetch entries when an IBSN is pasted on the main table. [#9864](https://github.com/JabRef/jabref/issues/9864)

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ public class FileFieldParser {
private final String value;

private StringBuilder charactersOfCurrentElement;

private boolean windowsPath;

public FileFieldParser(String value) {
this.value = value;
if (value == null) {
this.value = null;
} else {
this.value = value.replace("$\\backslash$", "\\");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ private static Stream<Arguments> stringsToParseTest() throws Exception {
"Desc:File.PDF:PDF"
),

// Mendeley input
Arguments.of(
Collections.singletonList(new LinkedFile("", Path.of("C:/Users/XXXXXX/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Brown - 2017 - Physical test methods for elastomers.pdf"), "pdf")),
":C$\\backslash$:/Users/XXXXXX/AppData/Local/Mendeley Ltd./Mendeley Desktop/Downloaded/Brown - 2017 - Physical test methods for elastomers.pdf:pdf"
),

// parseCorrectOnlineInput
Arguments.of(
Collections.singletonList(new LinkedFile(new URL("http://arxiv.org/pdf/2010.08497v1"), "PDF")),
Expand Down

0 comments on commit 228ce99

Please sign in to comment.