Skip to content

Commit 0b029ef

Browse files
authored
Merge pull request #953 from metacpan/mickey/search_term_reserved_chars
escape reserved chars in search term
2 parents d8e8962 + 598c801 commit 0b029ef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/MetaCPAN/Model/Search.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ sub search_web {
7979
$page_size //= 20;
8080
$from //= 0;
8181

82+
$search_term
83+
=~ s{([ + - = > < ! & | ( ) { } \[ \] ^ " ~ * ? : \ / ])}{\\$1}x;
84+
8285
# munge the search_term
8386
# these would be nicer if we had variable-length lookbehinds...
8487
# Allow q = 'author:LLAP' or 'module:Data::Page' or 'dist:'

0 commit comments

Comments
 (0)