Skip to content

Commit

Permalink
replace newlines in data from user input
Browse files Browse the repository at this point in the history
  • Loading branch information
tedpearson committed Feb 19, 2024
1 parent 294dea2 commit 20cc871
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions location.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ type LocationService struct {
// city, state|name
func (l LocationService) ParseLocation(s string) (*Location, error) {
parts := strings.Split(s, "|")
loc := parts[0]
loc := strings.ReplaceAll(parts[0], "\n", "")
loc = strings.ReplaceAll(loc, "\r", "")
var name string
if len(parts) > 1 {
name = parts[1]
name = strings.ReplaceAll(parts[1], "\n", "")
name = strings.ReplaceAll(name, "\r", "")
}
m := latLonRe.FindStringSubmatch(loc)
if m != nil {
Expand Down

0 comments on commit 20cc871

Please sign in to comment.