Skip to content

Commit

Permalink
Re-escaping from column with SQL Server support
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Reinhard <robert.reinhard@bukwild.com>
  • Loading branch information
weotch committed Jan 23, 2018
1 parent 7fe46a9 commit 3cae304
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions classes/Models/RedirectRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ public function scopeMatchUsingRequest($query)
return $query->where(function ($query) {
$from = $this->pathAndQuery();
$escaped_from = DB::connection()->getPdo()->quote($from);
$query->where('from', $from)->orWhereRaw("{$escaped_from} LIKE from");
$from_col = DB::getDriverName() == 'sqlsrv' ? '[from]' : '`from`';
$query->where('from', $from)->orWhereRaw("{$escaped_from} LIKE {$from_col}");
if (Config::get('decoy::core.allow_regex_in_redirects')) {
$query->orWhereRaw("{$escaped_from} REGEXP from");
$query->orWhereRaw("{$escaped_from} REGEXP {$from_col}");
}
});
}
Expand Down

0 comments on commit 3cae304

Please sign in to comment.