Skip to content

Commit

Permalink
URL Encoding didn't solve it, so I'm replacing "/" with "$" and back …
Browse files Browse the repository at this point in the history
…since "$" is not a character in base64 encoding.
  • Loading branch information
jdavidbakr committed May 7, 2016
1 parent 28a1ab0 commit 7ac1708
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/MailTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MailTrackerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions tests/MailTrackerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7ac1708

Please sign in to comment.