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 name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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>
|
||||
|
||||
<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/"
|
||||
path = strings.TrimPrefix(path, "/")
|
||||
if path == "" {
|
||||
if err := notFoundTemplate.Execute(w, ""); err != nil {
|
||||
log.Printf("[Error] Failed to render error page: %v", err)
|
||||
}
|
||||
notFoundHandler(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,9 +77,7 @@ func staticFileHandler(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := webFiles.ReadFile(filePath)
|
||||
if err != nil {
|
||||
log.Printf("[Error] Static file not found: %s", filePath)
|
||||
if err := notFoundTemplate.Execute(w, ""); err != nil {
|
||||
log.Printf("[Error] Failed to render error page: %v", err)
|
||||
}
|
||||
notFoundHandler(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user