mirror of
https://github.com/Open-Argon/http.ar.git
synced 2026-10-28 09:43:55 +00:00
fix a path bug that shows up on windows
This commit is contained in:
1 parent
0095015d7d
commit
83a18d0d74
3 files changed
+8
-3
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"name": "http.ar",
|
||||
"version": "1.1.6"
|
||||
"version": "1.1.7"
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import "url.ar" as url
|
||||
import "version" as version
|
||||
import "renderTemplate" as renderTemplate
|
||||
import "contentType" as contentType
|
||||
import "path_to_filename" as *
|
||||
|
||||
let __initHeaders() = {"content-type": "text/html; charset=utf-8", "server": "http.ar/"+version.version+" Argon/"+ArgonVersion}
|
||||
|
||||
@@ -45,9 +46,9 @@ let handle(routes, conn, onErr) = do
|
||||
let FILE = file.read(path)
|
||||
response.headers["content-type"] = contentType.getter(path)
|
||||
if (attachment) do
|
||||
response.headers["content-disposition"] = "attachment; filename="+attachment
|
||||
response.headers["content-disposition"] = "attachment; filename="+json.stringify(attachment)
|
||||
else do
|
||||
response.headers["content-disposition"] = "inline; filename="+json.stringify(path.split("/")[-1])
|
||||
response.headers["content-disposition"] = "inline; filename="+json.stringify(path_to_filename(path))
|
||||
let doRange = "range" in request.headers
|
||||
let FileSize = FILE.size()
|
||||
let size = FileSize
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
let path_to_filename(path) = do
|
||||
if (platform.os == "windows") do
|
||||
path = path.replace("\\", "/")
|
||||
return path.split("/")[-1]
|
||||
Reference in new issue
Block a user