Skip to content

Commit

Permalink
osm json, fix type regex matching
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmach committed Nov 29, 2022
1 parent 0c2c5e2 commit c1ee8be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
// Note that any errors encountered during marshaling will be different.
var CustomJSONMarshaler interface {
Marshal(v interface{}) ([]byte, error)
} = nil
}

// CustomJSONUnmarshaler can be set to have the code use a different
// json unmarshaler than the default in the standard library.
Expand All @@ -51,7 +51,7 @@ var CustomJSONMarshaler interface {
// Note that any errors encountered during unmarshaling will be different.
var CustomJSONUnmarshaler interface {
Unmarshal(data []byte, v interface{}) error
} = nil
}

func marshalJSON(v interface{}) ([]byte, error) {
if CustomJSONMarshaler == nil {
Expand Down
2 changes: 1 addition & 1 deletion osm.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (o *OSM) UnmarshalJSON(data []byte) error {
var jsonTypeRegexp = regexp.MustCompile(`"type"\s*:\s*"([^"]*)"`)

func findType(index int, data []byte) (string, error) {
matches := jsonTypeRegexp.FindAllSubmatch(data, -1)
matches := jsonTypeRegexp.FindAllSubmatch(data, 1)
if len(matches) > 0 {
return string(matches[0][1]), nil
}
Expand Down

0 comments on commit c1ee8be

Please sign in to comment.