diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 2cc7e5b2b..f2a91e180 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -7,6 +7,10 @@
+
+
+
+
diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/ImageUtil.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/ImageUtil.java
index 9fcc7c859..c6e0d0ddc 100755
--- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/ImageUtil.java
+++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/ImageUtil.java
@@ -255,7 +255,7 @@ public static BufferedImage createTransparentImage(int width, int height) {
*/
@CheckReturnValue
public static boolean isEmbeddedBase64Image(@Nullable String uri) {
- return uri != null && uri.startsWith("data:image/");
+ return uri != null && uri.startsWith("data:image");
}
/**
@@ -301,7 +301,7 @@ public static BufferedImage loadEmbeddedBase64Image(String imageDataUri) {
private interface Scaler {
/**
* Convenience method that returns a scaled instance of the
- * provided {@code BufferedImage}, taken from
+ * provided {@code BufferedImage}, taken from
* article on java.net by Chris Campbell.
*
* Expects the image to be fully loaded (e.g. no need to wait for loading on requesting height or width)
diff --git a/flying-saucer-core/src/test/java/org/xhtmlrenderer/util/ImageUtilTest.java b/flying-saucer-core/src/test/java/org/xhtmlrenderer/util/ImageUtilTest.java
new file mode 100644
index 000000000..457facc5f
--- /dev/null
+++ b/flying-saucer-core/src/test/java/org/xhtmlrenderer/util/ImageUtilTest.java
@@ -0,0 +1,33 @@
+package org.xhtmlrenderer.util;
+
+import org.junit.jupiter.api.Test;
+
+import java.awt.image.BufferedImage;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.xhtmlrenderer.util.ImageUtil.isEmbeddedBase64Image;
+import static org.xhtmlrenderer.util.ImageUtil.loadEmbeddedBase64Image;
+
+class ImageUtilTest {
+ @Test
+ void embeddedImageUrl() {
+ assertThat(isEmbeddedBase64Image(null)).isFalse();
+ assertThat(isEmbeddedBase64Image("")).isFalse();
+ assertThat(isEmbeddedBase64Image("https://selenide.org/images/selenide-logo-big.png")).isFalse();
+ assertThat(isEmbeddedBase64Image("data:image/png;base64,iVBORw0KG...")).isTrue();
+ assertThat(isEmbeddedBase64Image("data:image/png;base64, iVBORw0KGgo...")).isTrue();
+ assertThat(isEmbeddedBase64Image("data:image/; base64,iVBORw0KG...")).isTrue();
+ assertThat(isEmbeddedBase64Image("data:image/;base64,iVBORw0KG...")).isTrue();
+ assertThat(isEmbeddedBase64Image("data:image;base64,iVBORw0KG...")).isTrue();
+ assertThat(isEmbeddedBase64Image("data:image/svg+xml;utf8,