mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-23 01:11:49 +03:00
fix: embedded paths not found on windows
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/pocket-id/pocket-id/backend/internal/common"
|
"github.com/pocket-id/pocket-id/backend/internal/common"
|
||||||
@@ -40,7 +40,7 @@ func initApplicationImages() error {
|
|||||||
destinationFilesMap := make(map[string]bool, len(destinationFiles))
|
destinationFilesMap := make(map[string]bool, len(destinationFiles))
|
||||||
for _, f := range destinationFiles {
|
for _, f := range destinationFiles {
|
||||||
name := f.Name()
|
name := f.Name()
|
||||||
destFilePath := filepath.Join(dirPath, name)
|
destFilePath := path.Join(dirPath, name)
|
||||||
|
|
||||||
h, err := utils.CreateSha256FileHash(destFilePath)
|
h, err := utils.CreateSha256FileHash(destFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -69,8 +69,8 @@ func initApplicationImages() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
name := sourceFile.Name()
|
name := sourceFile.Name()
|
||||||
srcFilePath := filepath.Join("images", name)
|
srcFilePath := path.Join("images", name)
|
||||||
destFilePath := filepath.Join(dirPath, name)
|
destFilePath := path.Join(dirPath, name)
|
||||||
|
|
||||||
// Skip if there's already an image at the path
|
// Skip if there's already an image at the path
|
||||||
// We do not check the extension because users could have uploaded a different one
|
// We do not check the extension because users could have uploaded a different one
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package email
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
htemplate "html/template"
|
htemplate "html/template"
|
||||||
"path/filepath"
|
"path"
|
||||||
ttemplate "text/template"
|
ttemplate "text/template"
|
||||||
|
|
||||||
"github.com/pocket-id/pocket-id/backend/resources"
|
"github.com/pocket-id/pocket-id/backend/resources"
|
||||||
@@ -30,7 +30,7 @@ func PrepareTextTemplates(templates []string) (map[string]*ttemplate.Template, e
|
|||||||
textTemplates := make(map[string]*ttemplate.Template, len(templates))
|
textTemplates := make(map[string]*ttemplate.Template, len(templates))
|
||||||
for _, tmpl := range templates {
|
for _, tmpl := range templates {
|
||||||
filename := tmpl + "_text.tmpl"
|
filename := tmpl + "_text.tmpl"
|
||||||
templatePath := filepath.Join("email-templates", filename)
|
templatePath := path.Join("email-templates", filename)
|
||||||
|
|
||||||
parsedTemplate, err := ttemplate.ParseFS(resources.FS, templatePath)
|
parsedTemplate, err := ttemplate.ParseFS(resources.FS, templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -47,7 +47,7 @@ func PrepareHTMLTemplates(templates []string) (map[string]*htemplate.Template, e
|
|||||||
htmlTemplates := make(map[string]*htemplate.Template, len(templates))
|
htmlTemplates := make(map[string]*htemplate.Template, len(templates))
|
||||||
for _, tmpl := range templates {
|
for _, tmpl := range templates {
|
||||||
filename := tmpl + "_html.tmpl"
|
filename := tmpl + "_html.tmpl"
|
||||||
templatePath := filepath.Join("email-templates", filename)
|
templatePath := path.Join("email-templates", filename)
|
||||||
|
|
||||||
parsedTemplate, err := htemplate.ParseFS(resources.FS, templatePath)
|
parsedTemplate, err := htemplate.ParseFS(resources.FS, templatePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user