summaryrefslogtreecommitdiffstats
path: root/utils/subpath.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-06-28 17:57:42 -0400
committerSudheer <sudheer.105@gmail.com>2018-06-29 03:27:42 +0530
commit57bf7203f329c47220c457a891244e512ae868e6 (patch)
treec41cb8d884552168e483bded15f02367f7a9d87d /utils/subpath.go
parent4b2a6263547363c43dba9c320c077ad295caaf4d (diff)
downloadchat-57bf7203f329c47220c457a891244e512ae868e6.tar.gz
chat-57bf7203f329c47220c457a891244e512ae868e6.tar.bz2
chat-57bf7203f329c47220c457a891244e512ae868e6.zip
subpath: rewrite manifest.json too (#9017)
Diffstat (limited to 'utils/subpath.go')
-rw-r--r--utils/subpath.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/subpath.go b/utils/subpath.go
index cddc90fa4..be06a73ef 100644
--- a/utils/subpath.go
+++ b/utils/subpath.go
@@ -89,14 +89,14 @@ func UpdateAssetsSubpath(subpath string) error {
return errors.Wrapf(err, "failed to update root.html with subpath %s", subpath)
}
- // Rewrite the *.css references to `/static/*` (or a previously rewritten subpath).
+ // Rewrite the manifest.json and *.css references to `/static/*` (or a previously rewritten subpath).
err = filepath.Walk(staticDir, func(walkPath string, info os.FileInfo, err error) error {
- if filepath.Ext(walkPath) == ".css" {
- if oldCss, err := ioutil.ReadFile(walkPath); err != nil {
+ if filepath.Base(walkPath) == "manifest.json" || filepath.Ext(walkPath) == ".css" {
+ if old, err := ioutil.ReadFile(walkPath); err != nil {
return errors.Wrapf(err, "failed to open %s", walkPath)
} else {
- newCss := strings.Replace(string(oldCss), pathToReplace, newPath, -1)
- if err = ioutil.WriteFile(walkPath, []byte(newCss), 0); err != nil {
+ new := strings.Replace(string(old), pathToReplace, newPath, -1)
+ if err = ioutil.WriteFile(walkPath, []byte(new), 0); err != nil {
return errors.Wrapf(err, "failed to update %s with subpath %s", walkPath, subpath)
}
}