diff --git a/pom.xml b/pom.xml
index 30d1a5f..a80d320 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
io.github.sashirestela
cleverclient
- 1.4.2
+ 1.4.3
jar
cleverclient
diff --git a/src/main/java/io/github/sashirestela/cleverclient/support/HttpMultipart.java b/src/main/java/io/github/sashirestela/cleverclient/support/HttpMultipart.java
index 0678188..f4f6593 100644
--- a/src/main/java/io/github/sashirestela/cleverclient/support/HttpMultipart.java
+++ b/src/main/java/io/github/sashirestela/cleverclient/support/HttpMultipart.java
@@ -3,10 +3,11 @@
import io.github.sashirestela.cleverclient.util.Constant;
import java.io.IOException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -36,11 +37,12 @@ public static List toByteArrays(Map data) {
String mimeType = null;
byte[] fileContent = null;
try {
- var path = Path.of(new URL((String) entry.getValue()).getPath());
+ URI uri = new URI(entry.getValue().toString());
+ var path = Paths.get(uri);
fileName = path.toString();
mimeType = Files.probeContentType(path);
fileContent = Files.readAllBytes(path);
- } catch (IOException e) {
+ } catch (IOException | URISyntaxException e) {
throw new CleverClientException("Error trying to read the file {0}.", fileName, e);
}
byteArrays.add(toBytes(FIELD_NAME + DQ + fieldName + DQ + FILE_NAME + DQ + fileName + DQ + NL));