Bug 20218: Fix matching of uri in tracklinks

The current code matches using a regex, this breaks when the url
contains special characters. We swtich it to equality check

To test:
1 - Enable TrackClicks (either track or anonymous)
2 - Find the URL of a biblio in the OPAC
3 - Paste this into the 856$u of another record
    (or use any url containing a '?' or other characters)
4 - View the record in the opac
5 - Click the URL
6 - 404 Error!
7 - Apply patch
8 - Try again
9 - Success!

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 306b461a6a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2018-02-16 12:31:39 +00:00 committed by Fridolin Somers
parent 3386748176
commit 7616fa9dcd
1 changed files with 1 additions and 1 deletions

View File

@ -57,7 +57,7 @@ if ($uri) {
my $record = C4::Biblio::GetMarcBiblio($biblionumber);
my $marc_urls = C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour'));
if ( grep { /^$uri$/ } map { $_->{MARCURL} } @$marc_urls ) {
if ( grep { $_ eq $uri } map { $_->{MARCURL} } @$marc_urls ) {
$tracker->trackclick(
{
uri => $uri,