Преглед изворни кода

refactor(processor): improve the `rewrite` URL rule 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
Julien Voisin пре 1 година
родитељ
комит
fefbf2c935
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      internal/reader/processor/processor.go

+ 1 - 1
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) {