Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
a228cdb1
Commit
a228cdb1
authored
Sep 18, 2013
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 877545: quicksearch shouldn't treat apostrophes as quote characters
r=simon, a=glob
parent
e09c1e75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
Quicksearch.pm
Bugzilla/Search/Quicksearch.pm
+27
-6
No files found.
Bugzilla/Search/Quicksearch.pm
View file @
a228cdb1
...
@@ -138,7 +138,7 @@ sub quicksearch {
...
@@ -138,7 +138,7 @@ sub quicksearch {
# Retain backslashes and quotes, to know which strings are quoted,
# Retain backslashes and quotes, to know which strings are quoted,
# and which ones are not.
# and which ones are not.
my
@words
=
parse_line
(
'\s+'
,
1
,
$searchstring
);
my
@words
=
_
parse_line
(
'\s+'
,
1
,
$searchstring
);
# If parse_line() returns no data, this means strings are badly quoted.
# If parse_line() returns no data, this means strings are badly quoted.
# Rather than trying to guess what the user wanted to do, we throw an error.
# Rather than trying to guess what the user wanted to do, we throw an error.
scalar
(
@words
)
scalar
(
@words
)
...
@@ -194,7 +194,7 @@ sub quicksearch {
...
@@ -194,7 +194,7 @@ sub quicksearch {
# Loop over all main-level QuickSearch words.
# Loop over all main-level QuickSearch words.
foreach
my
$qsword
(
@qswords
)
{
foreach
my
$qsword
(
@qswords
)
{
my
@or_operand
=
parse_line
(
'\|'
,
1
,
$qsword
);
my
@or_operand
=
_
parse_line
(
'\|'
,
1
,
$qsword
);
foreach
my
$term
(
@or_operand
)
{
foreach
my
$term
(
@or_operand
)
{
my
$negate
=
substr
(
$term
,
0
,
1
)
eq
'-'
;
my
$negate
=
substr
(
$term
,
0
,
1
)
eq
'-'
;
if
(
$negate
)
{
if
(
$negate
)
{
...
@@ -208,7 +208,7 @@ sub quicksearch {
...
@@ -208,7 +208,7 @@ sub quicksearch {
# Having ruled out the special cases, we may now split
# Having ruled out the special cases, we may now split
# by comma, which is another legal boolean OR indicator.
# by comma, which is another legal boolean OR indicator.
# Remove quotes from quoted words, if any.
# Remove quotes from quoted words, if any.
@words
=
parse_line
(
','
,
0
,
$term
);
@words
=
_
parse_line
(
','
,
0
,
$term
);
foreach
my
$word
(
@words
)
{
foreach
my
$word
(
@words
)
{
if
(
!
_special_field_syntax
(
$word
,
$negate
))
{
if
(
!
_special_field_syntax
(
$word
,
$negate
))
{
_default_quicksearch_word
(
$word
,
$negate
);
_default_quicksearch_word
(
$word
,
$negate
);
...
@@ -260,6 +260,27 @@ sub quicksearch {
...
@@ -260,6 +260,27 @@ sub quicksearch {
# Parts of quicksearch() #
# Parts of quicksearch() #
##########################
##########################
sub
_parse_line
{
my
(
$delim
,
$keep
,
$line
)
=
@_
;
# parse_line always treats ' as a quote character, making it impossible
# to sanely search for contradictions. As this behavour isn't
# configurable, we replace ' with a placeholder to hide it from the
# parser.
# only treat ' at the start or end of words as quotes
# it's easier to do this in reverse with regexes
$line
=~
s/(^|\s|:)'/$1\001/g
;
$line
=~
s/'($|\s)/\001$1/g
;
$line
=~
s/\\?'/\000/g
;
$line
=~
tr
/\001/
'/;
my @words = parse_line($delim, $keep, $line);
foreach my $word (@words) {
$word =~ tr/\000/'
/
;
}
return
@words
;
}
sub
_bug_numbers_only
{
sub
_bug_numbers_only
{
my
$searchstring
=
shift
;
my
$searchstring
=
shift
;
my
$cgi
=
Bugzilla
->
cgi
;
my
$cgi
=
Bugzilla
->
cgi
;
...
@@ -365,10 +386,10 @@ sub _handle_field_names {
...
@@ -365,10 +386,10 @@ sub _handle_field_names {
# Generic field1,field2,field3:value1,value2 notation.
# Generic field1,field2,field3:value1,value2 notation.
# We have to correctly ignore commas and colons in quotes.
# We have to correctly ignore commas and colons in quotes.
my
@field_values
=
parse_line
(
':'
,
1
,
$or_operand
);
my
@field_values
=
_
parse_line
(
':'
,
1
,
$or_operand
);
if
(
scalar
@field_values
==
2
)
{
if
(
scalar
@field_values
==
2
)
{
my
@fields
=
parse_line
(
','
,
1
,
$field_values
[
0
]);
my
@fields
=
_
parse_line
(
','
,
1
,
$field_values
[
0
]);
my
@values
=
parse_line
(
','
,
1
,
$field_values
[
1
]);
my
@values
=
_
parse_line
(
','
,
1
,
$field_values
[
1
]);
foreach
my
$field
(
@fields
)
{
foreach
my
$field
(
@fields
)
{
my
$translated
=
_translate_field_name
(
$field
);
my
$translated
=
_translate_field_name
(
$field
);
# Skip and record any unknown fields
# Skip and record any unknown fields
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment