From 56bb83fb529d6d534bdee1785d99bed114274d81 Mon Sep 17 00:00:00 2001 From: Huohua Dev Date: Mon, 9 Feb 2026 14:39:54 +0800 Subject: [PATCH] fix: --fp flag drops all URLs due to inverted logic + blacklist extension dot mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 1: --fp (RemoveParameters) had inverted Contains check and Add() placed after continue, causing lastURL set to stay empty forever → 0 output. Bug 2: path.Ext() returns '.png' but blacklist stores 'png' (no dot), so blacklistMap.Contains() never matched. Added TrimPrefix to strip leading dot. Both fixes applied to WriteURLs and WriteURLsJSON. --- pkg/output/output.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/output/output.go b/pkg/output/output.go index 6b69475..b4677a5 100644 --- a/pkg/output/output.go +++ b/pkg/output/output.go @@ -23,14 +23,17 @@ func WriteURLs(writer io.Writer, results <-chan string, blacklistMap mapset.Set[ if err != nil { continue } - if path.Ext(u.Path) != "" && blacklistMap.Contains(strings.ToLower(path.Ext(u.Path))) { + ext := strings.TrimPrefix(strings.ToLower(path.Ext(u.Path)), ".") + if ext != "" && blacklistMap.Contains(ext) { continue } - if RemoveParameters && !lastURL.Contains(u.Host+u.Path) { - continue + if RemoveParameters { + if lastURL.Contains(u.Host + u.Path) { + continue // already seen this endpoint, skip duplicate params + } + lastURL.Add(u.Host + u.Path) } - lastURL.Add(u.Host + u.Path) buf.B = append(buf.B, []byte(result)...) buf.B = append(buf.B, "\n"...) @@ -51,7 +54,8 @@ func WriteURLsJSON(writer io.Writer, results <-chan string, blacklistMap mapset. if err != nil { continue } - if blacklistMap.Contains(strings.ToLower(path.Ext(u.Path))) { + ext := strings.TrimPrefix(strings.ToLower(path.Ext(u.Path)), ".") + if ext != "" && blacklistMap.Contains(ext) { continue } jr.Url = result