diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java b/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java index f4030860..d9933a24 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/upload/ThreadMultipartPostUpload.java @@ -6,12 +6,15 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; +import java.net.URI; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Map; import java.util.Map.Entry; + import javax.annotation.Nullable; /** @@ -80,11 +83,13 @@ public class ThreadMultipartPostUpload { String paramName = data.getKey(); Object paramData = data.getValue(); - if (paramData instanceof Path) { - Path uploadPath = (Path) paramData; + if (paramData instanceof URI) { + Path uploadPath = Paths.get((URI) paramData); + outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadPath.getFileName() + "\"" + CRLF); outputStream.writeBytes("Content-Type: image/png" + CRLF + CRLF); + Files.copy(uploadPath, outputStream); } else { outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"" + CRLF + CRLF);