File tree 1 file changed +5
-0
lines changed
src/main/java/ru/mystamps/web/service
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 29
29
import java .util .concurrent .TimeUnit ;
30
30
31
31
import org .apache .commons .lang3 .ArrayUtils ;
32
+ import org .apache .commons .lang3 .StringUtils ;
32
33
33
34
import org .slf4j .Logger ;
34
35
import org .slf4j .LoggerFactory ;
@@ -173,6 +174,10 @@ private Code validateConnection(HttpURLConnection conn) throws IOException {
173
174
}
174
175
175
176
String contentType = conn .getContentType ();
177
+
178
+ // We need only the first part from "text/html; charset=UTF-8"
179
+ contentType = StringUtils .substringBefore (contentType , ";" );
180
+
176
181
if (allowedContentTypes != null && !ArrayUtils .contains (allowedContentTypes , contentType )) {
177
182
// TODO(security): fix possible log injection
178
183
LOG .debug ("Couldn't download file: unsupported file type '{}'" , contentType );
You can’t perform that action at this time.
0 commit comments