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
3f1f4e57
Commit
3f1f4e57
authored
Mar 22, 2003
by
bbaetz%acm.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 195695 - Requesting a non-existant format results in an Internal Error
r=gerv, a=myk
parent
78db8be8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
globals.pl
globals.pl
+19
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+5
-0
No files found.
globals.pl
View file @
3f1f4e57
...
...
@@ -1490,6 +1490,7 @@ sub FormatTimeUnit {
# Constructs a format object from URL parameters. You most commonly call it
# like this:
# my $format = GetFormat("foo/bar", $::FORM{'format'}, $::FORM{'ctype'});
sub
GetFormat
{
my
(
$template
,
$format
,
$ctype
)
=
@_
;
...
...
@@ -1505,11 +1506,28 @@ sub GetFormat {
$template
.=
(
$format
?
"-$format"
:
""
);
$template
.=
".$ctype.tmpl"
;
# Now check that the template actually exists. We only want to check
# if the template exists; any other errors (eg parse errors) will
# end up being detected laer.
eval
{
Bugzilla
->
template
->
context
->
template
(
$template
);
};
# This parsing may seem fragile, but its OK:
# http://lists.template-toolkit.org/pipermail/templates/2003-March/004370.html
# Even if it is wrong, any sort of error is going to cause a failure
# eventually, so the only issue would be an incorrect error message
if
(
$@
&&
$@
->
info
=~
/: not found$/
)
{
ThrowUserError
(
"format_not_found"
,
{
'format'
=>
$format
,
'ctype'
=>
$ctype
,
});
}
# Else, just return the info
return
{
'template'
=>
$template
,
'extension'
=>
$ctype
,
'ctype'
=>
$::contenttypes
->
{
$ctype
}
||
"text/plain"
,
'ctype'
=>
$::contenttypes
->
{
$ctype
}
,
};
}
...
...
template/en/default/global/user-error.html.tmpl
View file @
3f1f4e57
...
...
@@ -192,6 +192,11 @@
[% ELSIF error == "flag_type_name_invalid" %]
[% title = "Flag Type Name Invalid" %]
The name <em>[% name FILTER html %]</em> must be 1-50 characters long.
[% ELSIF error == "format_not_found" %]
[% title = "Format Not Found" %]
The requested format <em>[% format FILTER html %]</em> does not exist with
a content type of <em>[% ctype FILTER html %]</em>.
[% ELSIF error == "flag_type_sortkey_invalid" %]
[% title = "Flag Type Sort Key Invalid" %]
...
...
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