mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
fix: do not alter the original URL if there is no tracker parameter
This commit is contained in:
parent
92f3dc26e4
commit
37309adbc0
2 changed files with 28 additions and 9 deletions
|
@ -78,14 +78,21 @@ func RemoveTrackingParameters(inputURL string) (string, error) {
|
|||
}
|
||||
|
||||
queryParams := parsedURL.Query()
|
||||
hasTrackers := false
|
||||
|
||||
// Remove tracking parameters
|
||||
for param := range queryParams {
|
||||
if trackingParams[strings.ToLower(param)] {
|
||||
queryParams.Del(param)
|
||||
hasTrackers = true
|
||||
}
|
||||
}
|
||||
|
||||
// Do not modify the URL if there are no tracking parameters
|
||||
if !hasTrackers {
|
||||
return inputURL, nil
|
||||
}
|
||||
|
||||
parsedURL.RawQuery = queryParams.Encode()
|
||||
|
||||
// Remove trailing "?" if query string is empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue