Bläddra i källkod

fix #1860 add thumbnail.html.image.generator.validation

Shinsuke Sugaya 6 år sedan
förälder
incheckning
0a95fad3d2

+ 26 - 0
src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java

@@ -950,6 +950,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
     /** The key of the configuration. e.g. svg,html,css,js */
     String THUMBNAIL_HTML_IMAGE_EXCLUDE_EXTENSIONS = "thumbnail.html.image.exclude.extensions";
 
+    /** The key of the configuration. e.g. true */
+    String THUMBNAIL_HTML_IMAGE_GENERATOR_VALIDATION = "thumbnail.html.image.generator.validation";
+
     /** The key of the configuration. e.g. 0 */
     String THUMBNAIL_GENERATOR_INTERVAL = "thumbnail.generator.interval";
 
@@ -4529,6 +4532,20 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
      */
     String getThumbnailHtmlImageExcludeExtensions();
 
+    /**
+     * Get the value for the key 'thumbnail.html.image.generator.validation'. <br>
+     * The value is, e.g. true <br>
+     * @return The value of found property. (NotNull: if not found, exception but basically no way)
+     */
+    String getThumbnailHtmlImageGeneratorValidation();
+
+    /**
+     * Is the property for the key 'thumbnail.html.image.generator.validation' true? <br>
+     * The value is, e.g. true <br>
+     * @return The determination, true or false. (if not found, exception but basically no way)
+     */
+    boolean isThumbnailHtmlImageGeneratorValidation();
+
     /**
      * Get the value for the key 'thumbnail.generator.interval'. <br>
      * The value is, e.g. 0 <br>
@@ -7502,6 +7519,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             return get(FessConfig.THUMBNAIL_HTML_IMAGE_EXCLUDE_EXTENSIONS);
         }
 
+        public String getThumbnailHtmlImageGeneratorValidation() {
+            return get(FessConfig.THUMBNAIL_HTML_IMAGE_GENERATOR_VALIDATION);
+        }
+
+        public boolean isThumbnailHtmlImageGeneratorValidation() {
+            return is(FessConfig.THUMBNAIL_HTML_IMAGE_GENERATOR_VALIDATION);
+        }
+
         public String getThumbnailGeneratorInterval() {
             return get(FessConfig.THUMBNAIL_GENERATOR_INTERVAL);
         }
@@ -8543,6 +8568,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
             defaultMap.put(FessConfig.THUMBNAIL_HTML_IMAGE_FORMAT, "png");
             defaultMap.put(FessConfig.THUMBNAIL_HTML_IMAGE_XPATH, "//IMG");
             defaultMap.put(FessConfig.THUMBNAIL_HTML_IMAGE_EXCLUDE_EXTENSIONS, "svg,html,css,js");
+            defaultMap.put(FessConfig.THUMBNAIL_HTML_IMAGE_GENERATOR_VALIDATION, "true");
             defaultMap.put(FessConfig.THUMBNAIL_GENERATOR_INTERVAL, "0");
             defaultMap.put(FessConfig.THUMBNAIL_GENERATOR_TARGETS, "all");
             defaultMap.put(FessConfig.THUMBNAIL_CRAWLER_ENABLED, "true");

+ 1 - 1
src/main/java/org/codelibs/fess/thumbnail/impl/HtmlTagBasedGenerator.java

@@ -151,7 +151,7 @@ public class HtmlTagBasedGenerator extends BaseThumbnailGenerator {
                 final ImageReadParam param = reader.getDefaultReadParam();
                 final int width = reader.getWidth(0);
                 final int height = reader.getHeight(0);
-                if (!fessConfig.validateThumbnailSize(width, height)) {
+                if (fessConfig.isThumbnailHtmlImageGeneratorValidation() && !fessConfig.validateThumbnailSize(width, height)) {
                     return Result.INVALID_SIZE;
                 }
                 final int samplingWidth = width / fessConfig.getThumbnailHtmlImageThumbnailWidthAsInteger();

+ 1 - 0
src/main/resources/fess_config.properties

@@ -500,6 +500,7 @@ thumbnail.html.image.thumbnail.height=100
 thumbnail.html.image.format=png
 thumbnail.html.image.xpath=//IMG
 thumbnail.html.image.exclude.extensions=svg,html,css,js
+thumbnail.html.image.generator.validation=true
 thumbnail.generator.interval=0
 thumbnail.generator.targets=all
 thumbnail.crawler.enabled=true