Skip to content

Commit

Permalink
Fix malfunction of GetStaticHandler (#80)
Browse files Browse the repository at this point in the history
* Fix Marketplace hostname in replaceHostname Function

The reason of this is double quoted/escaped url in javascript file. That prevents several OGame Page Browser functions like filter, Sort and page change of market lists.

* Update handlers.go

typo doubleescapedServerURL doubleEscapedServerURL

* Update handlers.go

Typo doubleescapedAPINewHostname -> doubleEscapedAPINewHostname

Co-authored-by: default <default>
  • Loading branch information
0xE232FE authored Aug 23, 2020
1 parent ea2f741 commit a0251c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,12 @@ func replaceHostname(bot *OGame, html []byte) []byte {
serverURLBytes := []byte(bot.serverURL)
apiNewHostnameBytes := []byte(bot.apiNewHostname)
escapedServerURL := bytes.Replace(serverURLBytes, []byte("/"), []byte(`\/`), -1)
doubleEscapedServerURL := bytes.Replace(serverURLBytes, []byte("/"), []byte("\\\\\\/"), -1)
escapedAPINewHostname := bytes.Replace(apiNewHostnameBytes, []byte("/"), []byte(`\/`), -1)
doubleEscapedAPINewHostname := bytes.Replace(apiNewHostnameBytes, []byte("/"), []byte("\\\\\\/"), -1)
html = bytes.Replace(html, serverURLBytes, apiNewHostnameBytes, -1)
html = bytes.Replace(html, escapedServerURL, escapedAPINewHostname, -1)
html = bytes.Replace(html, doubleEscapedServerURL, doubleEscapedAPINewHostname, -1)
return html
}

Expand Down

0 comments on commit a0251c4

Please sign in to comment.