--- a/src/Pure/General/http.scala Fri Feb 18 23:12:13 2022 +0100
+++ b/src/Pure/General/http.scala Sun Feb 20 15:22:12 2022 +0100
@@ -8,6 +8,7 @@
import java.io.{File => JFile}
+import java.nio.file.Files
import java.net.{InetSocketAddress, URI, URL, URLConnection, HttpURLConnection}
import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer}
@@ -38,8 +39,7 @@
{
val bytes = Bytes.read(file)
val file_name = file.getName
- val mime_type =
- Option(URLConnection.guessContentTypeFromName(file_name)).getOrElse(default_mime_type)
+ val mime_type = Option(Files.probeContentType(file.toPath)).getOrElse(default_mime_type)
Content(bytes, file_name = file_name, mime_type = mime_type)
}