we don't want to use filepath on embedded filesystems
This commit is contained in:
+2
-3
@@ -22,7 +22,6 @@ import (
|
|||||||
"mime"
|
"mime"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -70,13 +69,13 @@ func AmServeImage(c echo.Context) error {
|
|||||||
switch components[2] {
|
switch components[2] {
|
||||||
case "builtin/":
|
case "builtin/":
|
||||||
var b []byte
|
var b []byte
|
||||||
b, err = static_images.ReadFile(filepath.Join("static_images", components[3]))
|
b, err = static_images.ReadFile(fmt.Sprintf("static_images/%s", components[3]))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
||||||
}
|
}
|
||||||
case "ads/":
|
case "ads/":
|
||||||
var b []byte
|
var b []byte
|
||||||
b, err = ad_banners.ReadFile(filepath.Join("adbanners", components[3]))
|
b, err = ad_banners.ReadFile(fmt.Sprintf("adbanners/%s", components[3]))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,11 +13,11 @@ package ui
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"embed"
|
"embed"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.erbosoft.com/amy/amsterdam/config"
|
"git.erbosoft.com/amy/amsterdam/config"
|
||||||
@@ -133,7 +133,7 @@ func AmLoadHTMLResource(resourceName string) (string, string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if f == nil {
|
if f == nil {
|
||||||
f, err = static_resources.Open(filepath.Join("resources", resourceName))
|
f, err = static_resources.Open(fmt.Sprintf("resources/%s", resourceName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user