To recreate: 1 - Copy the url of a biblio in the opac 2 - Paste this into the 856$u ofd another record 3 - Enable anonymous link tracking 4 - View the second record in the opac 5 - Click the link 6 - Get a 404 error It seems on this line: if ( grep { /^$uri$/ } map { $_->{MARCURL} } @$marc_urls ) { The regex is reading the '?' in the uri as a special character and so the uri is not matched
Created attachment 71745 [details] [review] 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!
Hey Nick, I tried applying the patch (I'm currently on the master branch), but I got this error, Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 20218: Fix matching of uri in tracklinks Using index info to reconstruct a base tree... M opac/tracklinks.pl Falling back to patching base and 3-way merge... Auto-merging opac/tracklinks.pl CONFLICT (content): Merge conflict in opac/tracklinks.pl error: Failed to merge in the changes. Patch failed at 0001 Bug 20218: Fix matching of uri in tracklinks The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-20218-Fix-matching-of-uri-in-tracklinks-KoSJEI.patch Is there an extra step needed to apply this patch?
Applies cleanly for me on master, can you make sure you are up to date and try again?
Bumping severity - this breaks functionality for anyone using trackclicks and affects users directly
Created attachment 72215 [details] [review] 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>
Created attachment 72246 [details] [review] 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>
Pushed to master for 18.05, thanks to everybody involved!
Awesome work all! Pushed to stable for 17.11.04
Pushed to 17.05.x for v17.05.10