Skip to content

Commit

Permalink
Replace " by \" for nginx config (fix #19)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-messiah committed Apr 20, 2019
1 parent 3c228fc commit aa1374d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Expand Up @@ -13,14 +13,18 @@ script:
- go build -o ip2geo
- ./ip2geo
- TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo.t
- ./ip2geo -lang en -nobase64
- TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo.t
- ./ip2geo -ipver 6
- TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo_ipv6.t
- ./ip2geo -ipver 6 -lang en -nobase64
- TEST_NGINX_IP2GEO_DIR=$PWD prove t/nginx_geo_ipv6.t
after_success:
- GOOS=darwin go build -o ip2geo-mac
- GOOS=freebsd go build -o ip2geo-freebsd
- GOOS=linux GOARCH=386 go build -o ip2geo-linux32
- GOOS=linux GOARCH=amd64 go build -o ip2geo-linux64
- GOOS=linux GOARCH=arm go build -o ip2geo-linuxARM
- GOOS=linux GOARCH=arm go build -o ip2geo-linuxARM
- GOOS=openbsd go build -o ip2geo-openbsd
deploy:
provider: releases
Expand Down
4 changes: 2 additions & 2 deletions maxmind.go
Expand Up @@ -162,8 +162,8 @@ func (maxmind *MaxMind) writeMap(locations map[string]geoItem) error {
var cityName string
var countryName string
if maxmind.noBase64 {
cityName = "\"" + location.City + "\""
countryName = "\"" + location.Country + "\""
cityName = "\"" + strings.ReplaceAll(location.City, "\"", "\\\"") + "\""
countryName = "\"" + strings.ReplaceAll(location.Country, "\"", "\\\"") + "\""
} else {
cityName = base64.StdEncoding.EncodeToString([]byte(location.City))
countryName = base64.StdEncoding.EncodeToString([]byte(location.Country))
Expand Down

0 comments on commit aa1374d

Please sign in to comment.