Skip to content

Commit

Permalink
orderedparams deep copy
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed Jun 28, 2023
1 parent 886d743 commit 9eade5f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion url/orderedparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ func (o *OrderedParams) Decode(raw string) {
// Clone returns a copy of the ordered params
func (o *OrderedParams) Clone() *OrderedParams {
clone := NewOrderedParams()
clone.om = o.om.Clone()
o.om.Iterate(func(key string, value []string) bool {
// this needs to be a deep copy (from reference in nuclei race condition issue)
if len(value) != 0 {
clone.Add(key, value...)
} else {
clone.Add(key, "")
}
return true
})
return clone
}

0 comments on commit 9eade5f

Please sign in to comment.