Skip to content

Commit

Permalink
WW-4726 Fixes wrong value type used to limit upload
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Dec 20, 2016
1 parent 7e4d1b4 commit f78d90e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class AbstractMultiPartRequest implements MultiPartRequest {
/**
* Specifies the maximum size of the entire request.
*/
protected int maxSize;
protected long maxSize;
protected boolean maxSizeProvided;

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ public void setDefaultEncoding(String enc) {
@Inject(StrutsConstants.STRUTS_MULTIPART_MAXSIZE)
public void setMaxSize(String maxSize) {
this.maxSizeProvided = true;
this.maxSize = Integer.parseInt(maxSize);
this.maxSize = Long.parseLong(maxSize);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public void parse(HttpServletRequest servletRequest, String saveDir) throws IOEx
synchronized (this) {
setEncoding();
if (maxSizeProvided){
multi = new ServletMultipartRequest(servletRequest, saveDir, maxSize);
int intMaxSize = (maxSize >= Integer.MAX_VALUE ? Integer.MAX_VALUE : Long.valueOf(maxSize).intValue());
multi = new ServletMultipartRequest(servletRequest, saveDir, intMaxSize);
}else{
multi = new ServletMultipartRequest(servletRequest, saveDir);
}
Expand Down

0 comments on commit f78d90e

Please sign in to comment.