Skip to content

Commit

Permalink
src/main/java: Handle more corner cases in FixJpgJpgThumbnails.java
Browse files Browse the repository at this point in the history
We should make sure we are catching .JPG and .jpg. Also, we should
check for Generated Thumbnails as well as IM Thumbnail.
  • Loading branch information
alanorth committed Aug 6, 2020
1 parent cf7012d commit 2263ac2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static void processItem(Item item) throws SQLException, AuthorizeExcepti
for (Bitstream thumbnailBitstream : thumbnailBundleBitstreams) {
String thumbnailName = thumbnailBitstream.getName();

if (thumbnailName.contains(".jpg.jpg")) {
if (thumbnailName.toLowerCase().contains(".jpg.jpg")) {
Bundle[] originalBundles = item.getBundles("ORIGINAL");
for (Bundle originalBundle : originalBundles) {
Bitstream[] originalBundleBitstreams = originalBundle.getBitstreams();
Expand All @@ -88,7 +88,7 @@ private static void processItem(Item item) throws SQLException, AuthorizeExcepti
String originalName = originalBitstream.getName();

//check if the original file name is the same as the thumbnail name minus the extra ".jpg"
if (originalName.equals(StringUtils.removeEndIgnoreCase(thumbnailName, ".jpg")) && "Generated Thumbnail".equals(thumbnailBitstream.getDescription())) {
if (originalName.equalsIgnoreCase(StringUtils.removeEndIgnoreCase(thumbnailName, ".jpg")) && ("Generated Thumbnail".equals(thumbnailBitstream.getDescription()) || "IM Thumbnail".equals(thumbnailBitstream.getDescription()))) {
System.out.println(item.getHandle() + ": replacing " + thumbnailName + " with " + originalName);

//add the original bitstream to the THUMBNAIL bundle
Expand Down

0 comments on commit 2263ac2

Please sign in to comment.