From 7ac17086d51c697ff9d293bdde61c97b3bb31ca0 Mon Sep 17 00:00:00 2001 From: Jon Baker Date: Sat, 7 May 2016 12:01:32 -0500 Subject: [PATCH] URL Encoding didn't solve it, so I'm replacing "/" with "$" and back since "$" is not a character in base64 encoding. --- src/MailTracker.php | 2 +- src/MailTrackerController.php | 2 +- tests/MailTrackerTest.php | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/MailTracker.php b/src/MailTracker.php index c6a2df5..87dfc54 100644 --- a/src/MailTracker.php +++ b/src/MailTracker.php @@ -100,7 +100,7 @@ protected function inject_link_callback($matches) return $matches[1].action('\jdavidbakr\MailTracker\MailTrackerController@getL', [ - urlencode(base64_encode($url)), + str_replace("/","$",base64_encode($url)), // Replace slash with dollar sign $this->hash ]); } diff --git a/src/MailTrackerController.php b/src/MailTrackerController.php index 35211fe..1877e1a 100644 --- a/src/MailTrackerController.php +++ b/src/MailTrackerController.php @@ -39,7 +39,7 @@ public function getT($hash) public function getL($url, $hash) { - $url = base64_decode($url); + $url = base64_decode(str_replace("$","/",$url)); $tracker = Model\SentEmail::where('hash',$hash) ->first(); if($tracker) { diff --git a/tests/MailTrackerTest.php b/tests/MailTrackerTest.php index a140306..a6bbd0c 100644 --- a/tests/MailTrackerTest.php +++ b/tests/MailTrackerTest.php @@ -43,13 +43,12 @@ public function testLink() $clicks = $track->clicks; $clicks++; - $redirect = 'http://www.google.com'; + $redirect = 'http://mfn1.myfootballnow.com/community/thread/2/1636?page=4&x=tRnYCfp9mT#10111'; $url = action('\jdavidbakr\MailTracker\MailTrackerController@getL',[ - base64_encode($redirect), + str_replace("/","$",base64_encode($redirect)), // Replace slash with dollar sign $track->hash ]); - $this->call('GET',$url); $this->assertRedirectedTo($redirect);