From b31a407da31f103330bb657c407cf655519dc787 Mon Sep 17 00:00:00 2001 From: Andy Cohen Date: Fri, 19 Dec 2014 13:15:10 -0600 Subject: [PATCH] updated last match result bug --- Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs | 8 ++++++-- Hi.UrlRewrite/Processing/UrlRewriter.cs | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs b/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs index 1873593..db92d2d 100644 --- a/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs +++ b/Hi.UrlRewrite/Processing/Results/ProcessRequestResult.cs @@ -10,10 +10,14 @@ public class ProcessRequestResult public ProcessRequestResult(Uri originalUri, RuleResult finalRuleResult, bool matchedAtLeastOneRule, List processedResults) { OriginalUri = originalUri; - RewrittenUri = finalRuleResult.RewrittenUri; MatchedAtLeastOneRule = matchedAtLeastOneRule; ProcessedResults = processedResults; - FinalAction = finalRuleResult.ResultAction; + + if (finalRuleResult != null) + { + RewrittenUri = finalRuleResult.RewrittenUri; + FinalAction = finalRuleResult.ResultAction; + } } public Uri OriginalUri { get; set; } diff --git a/Hi.UrlRewrite/Processing/UrlRewriter.cs b/Hi.UrlRewrite/Processing/UrlRewriter.cs index c3398a1..9497fdb 100644 --- a/Hi.UrlRewrite/Processing/UrlRewriter.cs +++ b/Hi.UrlRewrite/Processing/UrlRewriter.cs @@ -73,11 +73,6 @@ public ProcessRequestResult ProcessRequestUrl(Uri requestUri, List var lastMatchedRuleResult = processedResults.FirstOrDefault(r => r.RuleMatched); - if (lastMatchedRuleResult == null) - { - return null; - } - var finalResult = new ProcessRequestResult(originalUri, lastMatchedRuleResult, matchedAtLeastOneRule, processedResults); return finalResult;