jlefebure / spring-boot-starter-minio

Minio starter for Spring Boot
Apache License 2.0
149 stars 70 forks source link

Upload without given headers produces UnsupportedOperationException #1

Closed vvursT closed 4 years ago

vvursT commented 4 years ago

Collections.EMPTY_MAP is immutable but used as Default-Parameter and will produce an UnsupportedOperationException, because internal putMethod will use it to add the Content-Type-Header later on.

if (contentType == null) {
            if (((Map)headerMap).get("Content-Type") == null) {
                ((Map)headerMap).put("Content-Type", "application/octet-stream");
            }
        } else {
            ((Map)headerMap).put("Content-Type", contentType);
        }

Replace it with null, thus the internal putObject will initialize it with a mutable HashMap.

vvursT commented 4 years ago

Apply #2 for fix.

jlefebure commented 4 years ago

Seems good to me, thanks for the fix. I will merge it and deploy a new release including it

jlefebure commented 4 years ago

Deploy has been made on release 1.4. Should be available on maven central in 20 minutes