From 12e557e7282a571421b6eea59d797a2c7d865b28 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Dec 2024 00:22:31 +0100 Subject: [PATCH] Improve the `rewrite` regex - Use `[^"]` instead of `.`, to help the regex engine to determine boundaries, instead of having it bruteforce its way to find them - Use `+` instead of `*`, as empty rules don't make sense --- internal/reader/processor/processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/reader/processor/processor.go b/internal/reader/processor/processor.go index 12ab44611e4..ceae674cd4d 100644 --- a/internal/reader/processor/processor.go +++ b/internal/reader/processor/processor.go @@ -25,7 +25,7 @@ import ( "github.com/tdewolff/minify/v2/html" ) -var customReplaceRuleRegex = regexp.MustCompile(`rewrite\("(.*)"\|"(.*)"\)`) +var customReplaceRuleRegex = regexp.MustCompile(`rewrite\("([^"]+)"\|"([^"]+)"\)`) // ProcessFeedEntries downloads original web page for entries and apply filters. func ProcessFeedEntries(store *storage.Storage, feed *model.Feed, user *model.User, forceRefresh bool) {