mirror of
https://github.com/projectdiscovery/subfinder
synced 2026-06-21 14:05:24 +00:00
fix(chinaz): accept empty arrays, check ValueType over truthiness
Addresses CodeRabbit review: jsoniter's ToBool returns false for empty arrays as well as missing keys, so a valid response with ContributingSubdomainList: [] would incorrectly trip the shape-mismatch branch. Switch to ValueType() != ArrayValue; the iteration loop handles empty arrays naturally (0 results, no error emitted).
This commit is contained in:
@@ -58,7 +58,7 @@ func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Se
|
||||
}
|
||||
|
||||
SubdomainList := jsoniter.Get(body, "Result").Get("ContributingSubdomainList")
|
||||
if !SubdomainList.ToBool() {
|
||||
if SubdomainList.ValueType() != jsoniter.ArrayValue {
|
||||
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: fmt.Errorf("chinaz: unexpected response shape, missing Result.ContributingSubdomainList")}
|
||||
s.errors++
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user