Skip to content

Commit 65d61be

Browse files
committed
re-added a getSuggestedFileName, used capitals for constant
1 parent ea2ecde commit 65d61be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

jablib/src/main/java/org/jabref/logic/externalfiles/LinkedFileHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private record GetTargetPathResult(boolean exists, boolean renamed, Path path) {
120120
private GetTargetPathResult getTargetPath(Path sourcePath, Path targetDirectory, boolean useSuggestedName) throws IOException {
121121
Path suggestedFileName;
122122
if (useSuggestedName) {
123-
suggestedFileName = Path.of(FileUtil.getFileExtension(sourcePath).orElse("pdf"));
123+
suggestedFileName = Path.of(getSuggestedFileName(FileUtil.getFileExtension(sourcePath).orElse("pdf")));
124124
} else {
125125
suggestedFileName = sourcePath.getFileName();
126126
}

jablib/src/main/java/org/jabref/model/entry/LinkedFile.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class LinkedFile implements Serializable {
4040

4141
private static final LinkedFile NULL_OBJECT = new LinkedFile("", Path.of(""), "");
4242

43-
private static final String pathDelimiter = System.getProperty("file.separator");
43+
private static final String PATH_DELIM = System.getProperty("file.separator");
4444

4545
// We have to mark these properties as transient because they can't be serialized directly
4646
private transient StringProperty description = new SimpleStringProperty();
@@ -235,8 +235,8 @@ public Optional<String> getFileName() {
235235
String linkedName = link.get();
236236
if (isOnlineLink(linkedName)) {
237237
return FileUtil.getFileNameFromUrl(linkedName);
238-
} else if (pathDelimiter != null) {
239-
int slash = linkedName.lastIndexOf(pathDelimiter);
238+
} else if (PATH_DELIM != null) {
239+
int slash = linkedName.lastIndexOf(PATH_DELIM);
240240
if (slash >= 0) {
241241
return Optional.of(FileUtil.getValidFileName(linkedName.substring(slash + 1)));
242242
} else {

0 commit comments

Comments
 (0)