Skip to content

Commit f91e308

Browse files
authored
Merge pull request #313 from bliteknight/patch-1
Query escape location to prevent bad request
2 parents 398fe0d + e569f19 commit f91e308

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chipper/pkg/wirepod/ttr/weather.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func getWeather(location string, botUnits string, hoursFromNow int) (string, str
247247
} else if weatherAPIProvider == "openweathermap.org" {
248248
// First use geocoding api to convert location into coordinates
249249
// E.G. http://api.openweathermap.org/geo/1.0/direct?q={city name},{state code},{country code}&limit={limit}&appid={API key}
250-
url := "http://api.openweathermap.org/geo/1.0/direct?q=" + location + "&limit=1&appid=" + weatherAPIKey
250+
url := "http://api.openweathermap.org/geo/1.0/direct?q=" + url.QueryEscape(location) + "&limit=1&appid=" + weatherAPIKey
251251
resp, err := http.Get(url)
252252
if err != nil {
253253
logger.Println(err)

0 commit comments

Comments
 (0)