diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f3d36c..1b10dd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.0.5](https://github.com/SIMBAChain/libsimba4j-platform/compare/v1.0.4...v1.0.5) (2023-08-21) + +### Fixes + +* Fix file upload file names not being captured. + + ## [1.0.4](https://github.com/SIMBAChain/libsimba4j-platform/compare/v1.0.3...v1.0.4) (2023-06-24) ### Fixes diff --git a/pom.xml b/pom.xml index c568bbd..3da9377 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ 4.0.0 com.simbachain libsimba4j-platform - 1.0.5-SNAPSHOT + 1.0.6-SNAPSHOT LibSimba4J Blocks Platform Java Client for SIMBA Chain Blocks Platform https://simbachain.github.io/libsimba4j/ diff --git a/src/main/java/com/simbachain/simba/SimbaClient.java b/src/main/java/com/simbachain/simba/SimbaClient.java index 6d64e80..7eb7c0e 100644 --- a/src/main/java/com/simbachain/simba/SimbaClient.java +++ b/src/main/java/com/simbachain/simba/SimbaClient.java @@ -467,9 +467,16 @@ protected HttpEntity createEntity(Map data, UploadFile... files) builder.addTextBody(key, d.toString()); } + Map names = new HashMap<>(); for (int i = 0; i < files.length; i++) { UploadFile file = files[i]; - builder.addBinaryBody(String.format("file_%s", i), file.getFile(), + String name = file.getName(); + if(names.get(name) != null) { + name = String.format("%s_%s", i, name); + } else { + names.put(name, name); + } + builder.addBinaryBody(name, file.getFile(), ContentType.create(file.getMimeType()), file.getName()); } return builder.build();