lens @ 438aa0e19b628923482dbc3fadcbb2e1ecfd5d7a

fix: Actually read from embedded

Previous implementation was not reading from embedded fs.
 1diff --git a/pkg/ext/fileserver.go b/pkg/ext/fileserver.go
 2index fdea08eb941ad2e92b15c9646aa4c4455c47d6a7..ee4a80b1127e7f7cb6d5d1124931b7f2d65b7b9b 100644
 3--- a/pkg/ext/fileserver.go
 4+++ b/pkg/ext/fileserver.go
 5@@ -2,6 +2,8 @@ package ext
 6 
 7 import (
 8 	"io/fs"
 9+	"mime"
10+	"path/filepath"
11 
12 	"github.com/valyala/fasthttp"
13 )
14@@ -10,9 +12,22 @@ type FileSystem interface {
15 	Open(name string) (fs.File, error)
16 }
17 
18+// This is a VERY simple file server. It does not take a lot into consideration
19+// and it should only be used to return small predictable files, like in the
20+// static folder.
21 func FileServer(rootFS FileSystem, rootPath string) fasthttp.RequestHandler {
22-	return func(r *fasthttp.RequestCtx) {
23-		path := r.UserValue("filepath").(string)
24-		r.SendFile(rootPath + path)
25+	return func(ctx *fasthttp.RequestCtx) {
26+		path := ctx.UserValue("filepath").(string)
27+
28+		f, err := rootFS.Open(rootPath + path)
29+		if err != nil {
30+			InternalServerError(ctx, err)
31+			return
32+		}
33+		defer f.Close()
34+
35+		m := mime.TypeByExtension(filepath.Ext(path))
36+		ctx.SetContentType(m)
37+		ctx.SetBodyStream(f, -1)
38 	}
39 }
40diff --git a/templates/layout.html b/templates/layout.html
41index e21ec5e8b6f8c4d9f66356eca18052a829dc7cc4..bbf1558ff080063b0610a80f4d9846a8a9cad9ce 100644
42--- a/templates/layout.html
43+++ b/templates/layout.html
44@@ -4,7 +4,7 @@     <head>
45         <meta charset="utf-8">
46         <title>img | {{block "title" .}} noop {{end}}</title> 
47         <link rel="stylesheet" href="/static/main.css">
48-        <link rel="icon" href="static/square.svg" sizes="any" type="image/svg+xml">
49+        <link rel="icon" href="/static/square.svg" sizes="any" type="image/svg+xml">
50         <meta name="viewport" content="width=device-width, initial-scale=1" />
51     </head>
52     <body>