This commit is contained in:
6
main.go
6
main.go
@@ -15,6 +15,7 @@ import (
|
|||||||
"smt/middlewares"
|
"smt/middlewares"
|
||||||
"smt/models"
|
"smt/models"
|
||||||
"smt/utils"
|
"smt/utils"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -58,7 +59,9 @@ func staticFileServer(content embed.FS) gin.HandlerFunc {
|
|||||||
// Root request should load index.htm
|
// Root request should load index.htm
|
||||||
if len(fileName) == 1 {
|
if len(fileName) == 1 {
|
||||||
log.Printf("staticFileServer replacing root request with index.html")
|
log.Printf("staticFileServer replacing root request with index.html")
|
||||||
fileName = "index.html"
|
fileName = "www/index.html"
|
||||||
|
} else {
|
||||||
|
fileName = strings.TrimLeft(fileName, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
//log.Printf("staticFileServer attempting to load filename '%s'\n", fileName)
|
//log.Printf("staticFileServer attempting to load filename '%s'\n", fileName)
|
||||||
@@ -66,6 +69,7 @@ func staticFileServer(content embed.FS) gin.HandlerFunc {
|
|||||||
// Try to open the file from the embedded FS
|
// Try to open the file from the embedded FS
|
||||||
file, err := content.Open(fileName)
|
file, err := content.Open(fileName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("staticFileServer error opening '%s' : '%s'\n", fileName, err)
|
||||||
c.String(http.StatusNotFound, "File not found")
|
c.String(http.StatusNotFound, "File not found")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user