Skip to content

Commit

Permalink
remove hue from js links
Browse files Browse the repository at this point in the history
  • Loading branch information
elferherrera committed Jun 16, 2022
1 parent a9fd83c commit b5c0282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions linker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Linker struct {

func new_linker(paths string) Linker {
quoted := `([='"])(` + paths + ")"
hue_base := `window.HUE_BASE_URL\s*[+]\s*'/hue'\s*[+]`
hue_base := `window.HUE_BASE_URL\s*[+]\s*'/hue'`

linker := Linker{
quoted_reg: regexp.MustCompile(quoted),
Expand All @@ -28,7 +28,7 @@ func (l *Linker) replace(file []byte, service_prefix string) []byte {
prefix := "$1" + strings.TrimSuffix(service_prefix, "/") + "$2"
replaced := l.quoted_reg.ReplaceAll(file, []byte(prefix))

replaced = l.hue_base_url.ReplaceAll(replaced, []byte("window.HUE_BASE_URL +"))
replaced = l.hue_base_url.ReplaceAll(replaced, []byte("window.HUE_BASE_URL"))

return replaced
}
6 changes: 5 additions & 1 deletion linker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ func TestLinker(t *testing.T) {
},
{
`link = window.HUE_BASE_URL+'/hue'+link;`,
`link = window.HUE_BASE_URL +link;`,
`link = window.HUE_BASE_URL+link;`,
},
{
`page__WEBPACK_IMPORTED_MODULE_3___default().base(window.HUE_BASE_URL + '/hue');`,
`page__WEBPACK_IMPORTED_MODULE_3___default().base(window.HUE_BASE_URL);`,
},
}

Expand Down

0 comments on commit b5c0282

Please sign in to comment.