Fix crash related to web server
This commit is contained in:
1 parent
e0338a5c05
commit
432f87ca52
2 files changed
+17
-2
No files matched your search
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Rare crash related to NavBar
|
- Rare crash related to NavBar
|
||||||
|
- Crash related to web server
|
||||||
|
|
||||||
## [0.25.3] - 2024-08-14
|
## [0.25.3] - 2024-08-14
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,14 @@ namespace Http
|
|||||||
function MimeType(uri = "" as string) as string
|
function MimeType(uri = "" as string) as string
|
||||||
map = m.MimeTypes
|
map = m.MimeTypes
|
||||||
if map = invalid
|
if map = invalid
|
||||||
map = ParseJson(ReadAsciiFile("libpkg:/config/mime-types.json5"))
|
json = ReadAsciiFile("libpkg:/config/mime-types.json5")
|
||||||
|
if StringUtils.IsNullOrEmpty(json)
|
||||||
|
return "application/octet-stream"
|
||||||
|
end if
|
||||||
|
map = ParseJson(json)
|
||||||
|
if not IsAssociativeArray(map)
|
||||||
|
return "application/octet-stream"
|
||||||
|
end if
|
||||||
m.MimeTypes = map
|
m.MimeTypes = map
|
||||||
end if
|
end if
|
||||||
ext = m.GetExtension(uri)
|
ext = m.GetExtension(uri)
|
||||||
@@ -29,7 +36,14 @@ namespace Http
|
|||||||
function HttpTitle(code = 0 as integer) as string
|
function HttpTitle(code = 0 as integer) as string
|
||||||
map = m.httpCodesMap
|
map = m.httpCodesMap
|
||||||
if map = invalid
|
if map = invalid
|
||||||
map = ParseJson(ReadAsciiFile("libpkg:/config/http-codes.json5"))
|
json = ReadAsciiFile("libpkg:/config/http-codes.json5")
|
||||||
|
if StringUtils.IsNullOrEmpty(json)
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
|
map = ParseJson(json)
|
||||||
|
if not IsAssociativeArray(map)
|
||||||
|
return ""
|
||||||
|
end if
|
||||||
m.httpCodesMap = map
|
m.httpCodesMap = map
|
||||||
end if
|
end if
|
||||||
return ValidString(map[`${code}`])
|
return ValidString(map[`${code}`])
|
||||||
|
|||||||
Reference in new issue
Block a user