From 4fdd05a3d76725caea39748837afe27b95b811f4 Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Wed, 12 Mar 2014 00:16:47 +1300
Subject: [PATCH] Fix bug where the segment is not detected as a pre-processed
 segment when it is one. This is because the Segment->getString returns URL
 decoded segment value (with information loss as it cannot be safely URL
 re-encoded)

---
 core/ArchiveProcessor/Rules.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index 6ac43ddc06..9aef10302d 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -69,7 +69,12 @@ class Rules
             // If the requested segment is one of the segments to pre-process
             // we ensure that any call to the API will trigger archiving of all reports for this segment
             $segment = $segment->getString();
-            if (in_array($segment, $segmentsToProcess)) {
+
+            // Turns out the getString() above returns the URL decoded segment string
+            $segmentsToProcessUrlDecoded = array_map('urldecode', $segmentsToProcess);
+
+            if (in_array($segment, $segmentsToProcess)
+                || in_array($segment, $segmentsToProcessUrlDecoded)) {
                 return true;
             }
         }
-- 
GitLab