mirror of
https://github.com/Luzifer/cloudkeys-go.git
synced 2024-11-08 22:20:05 +00:00
Fix request without filename
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9bd560a05a
commit
b0ff38946d
1 changed files with 6 additions and 1 deletions
|
@ -8,7 +8,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func serveAssets(res http.ResponseWriter, r *http.Request) {
|
func serveAssets(res http.ResponseWriter, r *http.Request) {
|
||||||
data, err := Asset(path.Join("dist", r.RequestURI[1:]))
|
var fileName = r.RequestURI[1:]
|
||||||
|
if fileName == "" {
|
||||||
|
fileName = "index.html"
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := Asset(path.Join("dist", fileName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(res, "Not found", http.StatusNotFound)
|
http.Error(res, "Not found", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue