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
9cfe048d
Commit
9cfe048d
authored
Dec 27, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 615574: Make every search done by buglist.cgi create a list_id, so that
even Saved Searches get "last list" support. r=LpSolit, a=LpSolit
parent
f573509b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
25 deletions
+61
-25
CGI.pm
Bugzilla/CGI.pm
+49
-0
Recent.pm
Bugzilla/Search/Recent.pm
+9
-0
User.pm
Bugzilla/User.pm
+2
-2
buglist.cgi
buglist.cgi
+1
-23
No files found.
Bugzilla/CGI.pm
View file @
9cfe048d
...
...
@@ -27,6 +27,7 @@ use strict;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Util
;
use
Bugzilla::Search::
Recent
;
use
File::
Basename
;
...
...
@@ -397,6 +398,54 @@ sub remove_cookie {
'-value'
=>
'X'
);
}
# This helps implement Bugzilla::Search::Recent, and also shortens search
# URLs that get POSTed to buglist.cgi.
sub
redirect_search_url
{
my
$self
=
shift
;
# If we're retreiving an old list, we never need to redirect or
# do anything related to Bugzilla::Search::Recent.
return
if
$self
->
param
(
'regetlastlist'
);
my
$user
=
Bugzilla
->
user
;
if
(
$user
->
id
)
{
# There are two conditions that could happen here--we could get a URL
# with no list id, and we could get a URL with a list_id that isn't
# ours.
my
$list_id
=
$self
->
param
(
'list_id'
);
my
$last_search
;
if
(
$list_id
)
{
# If we have a valid list_id, no need to redirect or clean.
return
if
Bugzilla::Search::
Recent
->
check_quietly
(
{
id
=>
$list_id
});
}
}
elsif
(
$self
->
request_method
ne
'POST'
)
{
# Logged-out users who do a GET don't get a list_id, don't get
# their URLs cleaned, and don't get redirected.
return
;
}
$self
->
clean_search_url
();
if
(
$user
->
id
)
{
# Insert a placeholder Bugzilla::Search::Recent, so that we know what
# the id of the resulting search will be. This is then pulled out
# of the Referer header when viewing show_bug.cgi to know what
# bug list we came from.
my
$recent_search
=
Bugzilla::Search::
Recent
->
create_placeholder
;
$self
->
param
(
'list_id'
,
$recent_search
->
id
);
}
# GET requests that lacked a list_id are always redirected. POST requests
# are only redirected if they're under the CGI_URI_LIMIT though.
my
$uri_length
=
length
(
$self
->
self_url
());
if
(
$self
->
request_method
()
ne
'POST'
or
$uri_length
<
CGI_URI_LIMIT
)
{
print
$self
->
redirect
(
-
url
=>
$self
->
self_url
());
exit
;
}
}
sub
redirect_to_https
{
my
$self
=
shift
;
my
$sslbase
=
Bugzilla
->
params
->
{
'sslbase'
};
...
...
Bugzilla/Search/Recent.pm
View file @
9cfe048d
...
...
@@ -90,6 +90,15 @@ sub check {
return
$search
;
}
sub
check_quietly
{
my
$class
=
shift
;
my
$error_mode
=
Bugzilla
->
error_mode
;
Bugzilla
->
error_mode
(
ERROR_MODE_DIE
);
my
$search
=
eval
{
$class
->
check
(
@_
)
};
Bugzilla
->
error_mode
(
$error_mode
);
return
$search
;
}
sub
new_from_cookie
{
my
(
$invocant
,
$bug_ids
)
=
@_
;
my
$class
=
ref
(
$invocant
)
||
$invocant
;
...
...
Bugzilla/User.pm
View file @
9cfe048d
...
...
@@ -408,8 +408,8 @@ sub recent_search_for {
if
(
$list_id
&&
$list_id
ne
'cookie'
)
{
# If we got a bad list_id (either some other user's or an expired
# one) don't crash, just don't return that list.
my
$search
=
eval
{
Bugzilla::Search::
Recent
->
check
({
id
=>
$list_id
})
}
;
my
$search
=
Bugzilla::Search::
Recent
->
check_quietly
(
{
id
=>
$list_id
})
;
return
$search
if
$search
;
}
...
...
buglist.cgi
View file @
9cfe048d
...
...
@@ -81,29 +81,7 @@ if (grep { $_ =~ /^cmd\-/ } $cgi->param()) {
exit
;
}
# If query was POSTed, clean the URL from empty parameters and redirect back to
# itself. This will make advanced search URLs more tolerable.
#
if
(
$cgi
->
request_method
()
eq
'POST'
)
{
$cgi
->
clean_search_url
();
my
$uri_length
=
length
(
$cgi
->
self_url
());
if
(
!
$cgi
->
param
(
'regetlastlist'
)
and
!
$cgi
->
param
(
'list_id'
)
and
$user
->
id
)
{
# Insert a placeholder Bugzilla::Search::Recent, so that we know what
# the id of the resulting search will be. This is then pulled out
# of the Referer header when viewing show_bug.cgi to know what
# bug list we came from.
my
$recent_search
=
Bugzilla::Search::
Recent
->
create_placeholder
;
$cgi
->
param
(
'list_id'
,
$recent_search
->
id
);
}
if
(
$uri_length
<
CGI_URI_LIMIT
)
{
print
$cgi
->
redirect
(
-
url
=>
$cgi
->
self_url
());
exit
;
}
}
$cgi
->
redirect_search_url
();
# Determine whether this is a quicksearch query.
my
$searchstring
=
$cgi
->
param
(
'quicksearch'
);
...
...
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