فهرست منبع

Merge pull request #2104 from cvium/avoid_catastrophic_backtracking

Simplify regex to avoid catastrophic backtracking

(cherry picked from commit 6f283d80dc00fe63b59dfb7a134528f295615da7)
Signed-off-by: Joshua Boniface <joshua@boniface.me>
Joshua M. Boniface 5 سال پیش
والد
کامیت
292d4b585b
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      Emby.Naming/Common/NamingOptions.cs

+ 2 - 2
Emby.Naming/Common/NamingOptions.cs

@@ -314,7 +314,7 @@ namespace Emby.Naming.Common
                 // This isn't a Kodi naming rule, but the expression below causes false positives,
                 // This isn't a Kodi naming rule, but the expression below causes false positives,
                 // so we make sure this one gets tested first.
                 // so we make sure this one gets tested first.
                 // "Foo Bar 889"
                 // "Foo Bar 889"
-                new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>(\w+\s*?)*)\s(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*[^\\\/]*$")
+                new EpisodeExpression(@".*[\\\/](?![Ee]pisode)(?<seriesname>[\w\s]+?)\s(?<epnumber>\d{1,3})(-(?<endingepnumber>\d{2,3}))*[^\\\/]*$")
                 {
                 {
                     IsNamed = true
                     IsNamed = true
                 },
                 },
@@ -337,7 +337,7 @@ namespace Emby.Naming.Common
                 // *** End Kodi Standard Naming
                 // *** End Kodi Standard Naming
 
 
                 // [bar] Foo - 1 [baz]
                 // [bar] Foo - 1 [baz]
-                new EpisodeExpression(@".*?(\[.*?\])+.*?(?<seriesname>(\w+\s*?)+?)[-\s_]+(?<epnumber>\d+).*$")
+                new EpisodeExpression(@".*?(\[.*?\])+.*?(?<seriesname>[\w\s]+?)[-\s_]+(?<epnumber>\d+).*$")
                 {
                 {
                     IsNamed = true
                     IsNamed = true
                 },
                 },