mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-25 08:45:58 +03:00
[PR #1391] fix(template): use path.Join and rename parameter to fix embed path on Windows #5702
Labels
No labels
Q/A
bug
casdoor
dependencies
docker
documentation
duplicate
enhancement
help wanted
invalid
lego
platform:openwrt
platform:windows
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-ui#5702
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/0xJacky/nginx-ui/pull/1391
State: closed
Merged: Yes
Summary
This PR fixes an issue where templates embedded with //go:embed couldn't be opened on Windows because paths were constructed with filepath.Join which produces backslashes (e.g.
block\letsencrypt.conf). embed.FS expects forward slashes.Changes
path->dirin:GetTemplateInfoParseTemplatepath.Join(dir, name)instead offilepath.Join(...)import "path/filepath"withimport "path"where appropriate.Why
embed.FSnormalizes file names with forward slashes (/). On Windowsfilepath.Joinproduces backslashes which lead to "file does not exist" errors at runtime.path.Joinworks on Linux/macOS and Windows for embedded resources.