This commit is contained in:
+4
-3
@@ -2,6 +2,7 @@ package svg
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -20,7 +21,7 @@ type SvgStorage interface {
|
||||
AddFont(reader io.Reader, format string) error
|
||||
GetFonts() ([]string, error)
|
||||
GetFontsDir() string
|
||||
CreatePublic(data io.Reader, filetype string) (string, error)
|
||||
CreatePublic(data io.Reader, suffix string, filetype string) (string, error)
|
||||
GetPublic(path string) (io.ReadCloser, error)
|
||||
GetPublicDir() http.Dir
|
||||
}
|
||||
@@ -86,13 +87,13 @@ func (f FileSvgStorage) List() ([]os.DirEntry, error) {
|
||||
return os.ReadDir(f.basepath)
|
||||
}
|
||||
|
||||
func (f FileSvgStorage) CreatePublic(data io.Reader, filetype string) (string, error) {
|
||||
func (f FileSvgStorage) CreatePublic(data io.Reader, suffix string, filetype string) (string, error) {
|
||||
path := filepath.Join(f.basepath, f.publicSubPath)
|
||||
if err := os.MkdirAll(path, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
file, err := os.CreateTemp(path, "*."+filetype)
|
||||
file, err := os.CreateTemp(path, fmt.Sprintf("*-%s."+filetype, suffix))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user