diff --git a/utils/subpath.go b/utils/subpath.go index 6bfccad5f3..d294de2da5 100644 --- a/utils/subpath.go +++ b/utils/subpath.go @@ -45,14 +45,14 @@ func GetSubpathScriptHash(subpath string) string { return fmt.Sprintf(" 'sha256-%s'", base64.StdEncoding.EncodeToString(scriptHash[:])) } -// UpdateAssetsSubpath rewrites assets in the /client directory to assume the application is hosted -// at the given subpath instead of at the root. No changes are written unless necessary. -func UpdateAssetsSubpath(subpath string) error { +// UpdateAssetsSubpathInDir rewrites assets in the given directory to assume the application is +// hosted at the given subpath instead of at the root. No changes are written unless necessary. +func UpdateAssetsSubpathInDir(subpath, directory string) error { if subpath == "" { subpath = "/" } - staticDir, found := fileutils.FindDir(model.CLIENT_DIR) + staticDir, found := fileutils.FindDir(directory) if !found { return errors.New("failed to find client dir") } @@ -139,6 +139,12 @@ func UpdateAssetsSubpath(subpath string) error { return nil } +// UpdateAssetsSubpath rewrites assets in the /client directory to assume the application is hosted +// at the given subpath instead of at the root. No changes are written unless necessary. +func UpdateAssetsSubpath(subpath string) error { + return UpdateAssetsSubpathInDir(subpath, model.CLIENT_DIR) +} + // UpdateAssetsSubpathFromConfig uses UpdateAssetsSubpath and any path defined in the SiteURL. func UpdateAssetsSubpathFromConfig(config *model.Config) error { // Don't rewrite in development environments, since webpack in developer mode constantly