Skip to content

Commit

Permalink
More windows problems
Browse files Browse the repository at this point in the history
  • Loading branch information
MancunianSam committed Mar 7, 2025
1 parent 40aa670 commit 12a1388
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import java.net.URI;
import java.net.http.HttpClient;
import java.nio.charset.Charset;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -103,7 +104,7 @@ static HttpServer createHttpServer() throws IOException {
HttpServer httpServer = HttpServer.create();
httpServer.createContext("/", exchange -> {
String range = exchange.getRequestHeaders().get("Range").getFirst();
long size = Files.size(Path.of(exchange.getRequestURI().toString()));
long size = Files.size(Paths.get(URI.create("file://" + exchange.getRequestURI().toString())));
byte[] bytesForRange = getBytesForRange(exchange.getRequestURI().getPath(), range);

exchange.getResponseHeaders().add("Content-Range", range.replace("=", " ") + "/" + size);
Expand All @@ -127,7 +128,8 @@ static HttpServer createS3Server() throws IOException {

if (exchange.getRequestMethod().equals("GET") && queryParams.containsKey("list-type") && queryParams.get("list-type").equals("2")) {
String fileName = queryParams.get("prefix");
long size = Files.size(Path.of("/" + fileName));
FileSystems.getDefault().getPath(fileName);
long size = Files.size(Paths.get(URI.create("file:///" + fileName)));
String response =
"<ListBucketResult>" +
"<Contents>" +
Expand Down

0 comments on commit 12a1388

Please sign in to comment.