Skip to content

Commit 90785fb

Browse files
Copilotcubap
andcommitted
Fix case-insensitive extension stripping to handle old .JPG files
Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
1 parent 9df33a1 commit 90785fb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/java/textdisplay/Folio.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,10 @@ public String getImageName() throws SQLException {
614614
if (rs.next()) {
615615
toret += rs.getString("imageName");
616616
}
617-
if (toret.contains(".jpg")) {
618-
toret = toret.replaceAll("\\.jpg", "");
617+
// Strip .jpg/.JPG/.jpeg/.JPEG extension (case-insensitive)
618+
// This handles both new lowercase .jpg and old uppercase .JPG files
619+
if (toret.toLowerCase().contains(".jpg") || toret.toLowerCase().contains(".jpeg")) {
620+
toret = toret.replaceAll("(?i)\\.jpe?g$", "");
619621
}
620622
return toret;
621623
} finally {
@@ -640,8 +642,10 @@ public static String getImageName(String pageName) throws SQLException {
640642
if (rs.next()) {
641643
toret += rs.getString("imageName");
642644
}
643-
if (toret.contains(".jpg")) {
644-
toret = toret.replaceAll("\\.jpg", "");
645+
// Strip .jpg/.JPG/.jpeg/.JPEG extension (case-insensitive)
646+
// This handles both new lowercase .jpg and old uppercase .JPG files
647+
if (toret.toLowerCase().contains(".jpg") || toret.toLowerCase().contains(".jpeg")) {
648+
toret = toret.replaceAll("(?i)\\.jpe?g$", "");
645649
}
646650
return toret;
647651
} finally {

0 commit comments

Comments
 (0)