Resolve the possible panic caused by the document server
This commit is contained in:
0
docs/css/index.css
Normal file
0
docs/css/index.css
Normal file
@@ -5,6 +5,17 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title></title>
|
<title></title>
|
||||||
|
<link rel="preload" href="/js/index.js" as="script">
|
||||||
|
<link rel="preload" href="/js/layout.js" as="script">
|
||||||
|
<link rel="preload" href="/js/i18n.js" as="script">
|
||||||
|
<link rel="preload" href="/css/layout.css" as="style" onload="this.rel='stylesheet'">
|
||||||
|
<link rel="preload" href="/css/index.css" as="style" onload="this.rel='stylesheet'">
|
||||||
|
<link rel="preload" href="/font-awesome/css/all.min.css" as="style" onload="this.rel='stylesheet'">
|
||||||
|
<link rel="preload" href="/img/background_v0.1.x.webp" as="image">
|
||||||
|
<link rel="preload" href="/font-awesome/webfonts/fa-brands-400.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
|
<link rel="preload" href="/font-awesome/webfonts/fa-regular-400.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
|
<link rel="preload" href="/font-awesome/webfonts/fa-solid-900.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
|
<link rel="preload" href="/font-awesome/webfonts/fa-v4compatibility.woff2" as="font" type="font/woff2" crossorigin>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
8
main.go
8
main.go
@@ -68,9 +68,7 @@ func staticFileHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
// Clean path, make sure it starts with "docs/"
|
// Clean path, make sure it starts with "docs/"
|
||||||
path = strings.TrimPrefix(path, "/")
|
path = strings.TrimPrefix(path, "/")
|
||||||
if path == "" {
|
if path == "" {
|
||||||
if err := notFoundTemplate.Execute(w, ""); err != nil {
|
notFoundHandler(w, r)
|
||||||
log.Printf("[Error] Failed to render error page: %v", err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,9 +77,7 @@ func staticFileHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
data, err := webFiles.ReadFile(filePath)
|
data, err := webFiles.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[Error] Static file not found: %s", filePath)
|
log.Printf("[Error] Static file not found: %s", filePath)
|
||||||
if err := notFoundTemplate.Execute(w, ""); err != nil {
|
notFoundHandler(w, r)
|
||||||
log.Printf("[Error] Failed to render error page: %v", err)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user