diff --git a/changes.xml b/changes.xml
index b364bac3..b52da620 100644
--- a/changes.xml
+++ b/changes.xml
@@ -23,6 +23,12 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
+
+
+ Autocropped DAM renditions should not have fallback flag.
+
+
+
Enable media handler pre- and post-processor by setting media as invalid via a MediaInvalidReason.CUSTOM accompanied with a custom message.
diff --git a/pom.xml b/pom.xml
index 914fa537..7865155c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,13 +25,13 @@
io.wcm
io.wcm.parent_toplevel
- 2.0.0
+ 2.0.2
io.wcm
io.wcm.handler.media
- 1.14.0
+ 1.14.2
jar
Media Handler
@@ -49,7 +49,7 @@
handler/media
- 2022-03-14T16:54:52Z
+ 2022-04-07T12:41:33Z
diff --git a/src/main/java/io/wcm/handler/mediasource/dam/impl/DamRendition.java b/src/main/java/io/wcm/handler/mediasource/dam/impl/DamRendition.java
index 3be64a10..a28c049b 100644
--- a/src/main/java/io/wcm/handler/mediasource/dam/impl/DamRendition.java
+++ b/src/main/java/io/wcm/handler/mediasource/dam/impl/DamRendition.java
@@ -83,7 +83,9 @@ class DamRendition extends SlingAdaptable implements Rendition {
renditionHandler = new DefaultRenditionHandler(damContext);
resolvedRendition = renditionHandler.getRendition(mediaArgs);
}
- fallback = true;
+ if (resolvedRendition != null) {
+ fallback = true;
+ }
}
}
diff --git a/src/test/java/io/wcm/handler/mediasource/dam/DamMediaSourceTest.java b/src/test/java/io/wcm/handler/mediasource/dam/DamMediaSourceTest.java
index c6982091..99a1d3f3 100644
--- a/src/test/java/io/wcm/handler/mediasource/dam/DamMediaSourceTest.java
+++ b/src/test/java/io/wcm/handler/mediasource/dam/DamMediaSourceTest.java
@@ -50,6 +50,7 @@
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -689,18 +690,22 @@ void testMultipleMandatoryMediaFormatsWithCropping_AlsoMatchOriginal_AutoCrop()
assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.84.40.0,0,840,400.file/sixteen-ten.jpg",
renditions.get(0).getUrl(), "rendition.mediaUrl.1");
assertEquals(SHOWROOM_CONTROLS, renditions.get(0).getMediaFormat());
-
- assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original./sixteen-ten.jpg",
- renditions.get(1).getUrl(), "rendition.mediaUrl.2");
- assertEquals(RATIO, renditions.get(1).getMediaFormat());
+ assertFalse(renditions.get(0).isFallback());
assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.1333.1000.134,0,1467,1000.file/sixteen-ten.jpg",
- renditions.get(2).getUrl(), "rendition.mediaUrl.1");
- assertEquals(RATIO2, renditions.get(2).getMediaFormat());
+ renditions.get(1).getUrl(), "rendition.mediaUrl.1");
+ assertEquals(RATIO2, renditions.get(1).getMediaFormat());
+ assertFalse(renditions.get(1).isFallback());
assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original.image_file.960.150.0,375,1600,625.file/sixteen-ten.jpg",
- renditions.get(3).getUrl(), "rendition.mediaUrl.1");
- assertEquals(EDITORIAL_STAGE_SMALL, renditions.get(3).getMediaFormat());
+ renditions.get(2).getUrl(), "rendition.mediaUrl.1");
+ assertEquals(EDITORIAL_STAGE_SMALL, renditions.get(2).getMediaFormat());
+ assertFalse(renditions.get(2).isFallback());
+
+ assertEquals("/content/dam/test/sixteen-ten.jpg/_jcr_content/renditions/original./sixteen-ten.jpg",
+ renditions.get(3).getUrl(), "rendition.mediaUrl.2");
+ assertEquals(RATIO, renditions.get(3).getMediaFormat());
+ assertTrue(renditions.get(3).isFallback());
}
/**
diff --git a/src/test/java/io/wcm/handler/mediasource/dam/impl/AutoCroppingMediaHandlerTest.java b/src/test/java/io/wcm/handler/mediasource/dam/impl/AutoCroppingMediaHandlerTest.java
index 440fc5b3..403ee79f 100644
--- a/src/test/java/io/wcm/handler/mediasource/dam/impl/AutoCroppingMediaHandlerTest.java
+++ b/src/test/java/io/wcm/handler/mediasource/dam/impl/AutoCroppingMediaHandlerTest.java
@@ -160,6 +160,7 @@ void testInvalidManualCroppingParametersFallbackToAutoCropping() {
Rendition rendition = media.getRendition();
assertEquals(320, rendition.getWidth());
assertEquals(200, rendition.getHeight());
+ assertFalse(rendition.isFallback());
assertEquals("/content/dam/test.jpg/_jcr_content/renditions/original.image_file.320.200.40,0,360,200.file/test.jpg", media.getUrl());
}