Fix handling of no max object size limit A max object size limit of 0 means that there is no limit for the max object size. Change-Id: I39630e506b339e4ec3f2a5a6156100414ecb9998 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java index 301402d..843815e 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java +++ b/src/main/java/com/googlesource/gerrit/plugins/imagare/PostImage.java
@@ -149,7 +149,9 @@ private String storeImage(ProjectControl pc, MimeType mimeType, byte[] content, String fileName) throws AuthException, IOException, ResourceConflictException { - if (content.length > getEffectiveMaxObjectSizeLimit(pc.getProjectState())) { + long maxSize = getEffectiveMaxObjectSizeLimit(pc.getProjectState()); + // maxSize == 0 means that there is no limit + if (maxSize > 0 && content.length > maxSize) { throw new ResourceConflictException("image too large"); }