File tree 1 file changed +4
-2
lines changed
src/main/java/ru/mystamps/web/service
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -184,10 +184,12 @@ private Code validateConnection(HttpURLConnection conn) throws IOException {
184
184
return Code .INVALID_FILE_TYPE ;
185
185
}
186
186
187
- // TODO: content length can be -1 for gzipped responses
188
187
// TODO: add protection against huge files
188
+ // When the content length is not known, methods returns -1. It also happens for gzipped
189
+ // response. In this case, we allow to download a file and relies to a form validation
190
+ // that will take place later.
189
191
int contentLength = conn .getContentLength ();
190
- if (contentLength < 0 ) {
192
+ if (contentLength == 0 ) {
191
193
// TODO(security): fix possible log injection
192
194
LOG .debug ("Couldn't download file: invalid Content-Length: {}" , contentLength );
193
195
return Code .INVALID_FILE_SIZE ;
You can’t perform that action at this time.
0 commit comments