Skip to content

Commit 20cc871

Browse files
committed
replace newlines in data from user input
1 parent 294dea2 commit 20cc871

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

location.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ type LocationService struct {
2828
// city, state|name
2929
func (l LocationService) ParseLocation(s string) (*Location, error) {
3030
parts := strings.Split(s, "|")
31-
loc := parts[0]
31+
loc := strings.ReplaceAll(parts[0], "\n", "")
32+
loc = strings.ReplaceAll(loc, "\r", "")
3233
var name string
3334
if len(parts) > 1 {
34-
name = parts[1]
35+
name = strings.ReplaceAll(parts[1], "\n", "")
36+
name = strings.ReplaceAll(name, "\r", "")
3537
}
3638
m := latLonRe.FindStringSubmatch(loc)
3739
if m != nil {

0 commit comments

Comments
 (0)