Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
0f3a107d
Commit
0f3a107d
authored
Jan 19, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug #88: use decode_utf8_parameters()
parent
cac10d52
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
APIDaemon.pm
PVE/APIDaemon.pm
+1
-1
REST.pm
PVE/REST.pm
+8
-8
No files found.
PVE/APIDaemon.pm
View file @
0f3a107d
...
...
@@ -237,7 +237,7 @@ my $extract_params = sub {
$params
->
{
$k
}
=
$query_params
->
{
$k
};
}
return
$params
;
return
PVE::Tools::
decode_utf8_parameters
(
$params
)
;
};
sub
handle_requests
{
...
...
PVE/REST.pm
View file @
0f3a107d
...
...
@@ -69,10 +69,10 @@ sub format_response_data {
my
(
$ct
,
$raw
);
if
(
$format
eq
'
json
')
{
$ct
=
'
application/json
';
$ct
=
'
application/json
;charset=UTF-8
';
$raw
=
to_json
(
$data
,
{
utf8
=>
1
,
allow_nonref
=>
1
});
}
elsif
(
$format
eq
'
html
')
{
$ct
=
'
text/html
';
$ct
=
'
text/html
;charset=UTF-8
';
$raw
=
"
<html><body>
";
if
(
!
is_success
(
$res
->
{
status
}))
{
my
$msg
=
$res
->
{
message
}
||
'';
...
...
@@ -102,7 +102,7 @@ sub format_response_data {
}
}
else
{
$raw
.=
"
<pre>
";
$raw
.=
encode_entities
(
to_json
(
$data
,
{
utf8
=>
1
,
allow_nonref
=>
1
,
pretty
=>
1
}));
$raw
.=
encode_entities
(
to_json
(
$data
,
{
allow_nonref
=>
1
,
pretty
=>
1
}));
$raw
.=
"
</pre>
";
}
$raw
.=
"
</body></html>
";
...
...
@@ -122,14 +122,14 @@ sub format_response_data {
}
}
elsif
(
$format
eq
'
extjs
')
{
$ct
=
'
application/json
';
$ct
=
'
application/json
;charset=UTF-8
';
$raw
=
to_json
(
$data
,
{
utf8
=>
1
,
allow_nonref
=>
1
});
}
elsif
(
$format
eq
'
htmljs
')
{
# we use this for extjs file upload forms
$ct
=
'
text/html
';
$raw
=
encode_entities
(
to_json
(
$data
,
{
utf8
=>
1
,
allow_nonref
=>
1
}));
$ct
=
'
text/html
;charset=UTF-8
';
$raw
=
encode_entities
(
to_json
(
$data
,
{
allow_nonref
=>
1
}));
}
else
{
$ct
=
'
text/plain
';
$ct
=
'
text/plain
;charset=UTF-8
';
$raw
=
to_json
(
$data
,
{
utf8
=>
1
,
allow_nonref
=>
1
,
pretty
=>
1
});
}
...
...
@@ -462,7 +462,7 @@ sub rest_handler {
sub
split_abs_uri
{
my
(
$abs_uri
)
=
@_
;
my
(
$format
,
$rel_uri
)
=
$abs_uri
=~
m/^\Q$baseuri\E\/+(html|json|extjs|png|htmljs)(\/.*)?$/
;
my
(
$format
,
$rel_uri
)
=
$abs_uri
=~
m/^\Q$baseuri\E\/+(html|
text|
json|extjs|png|htmljs)(\/.*)?$/
;
$rel_uri
=
'
/
'
if
!
$rel_uri
;
return
wantarray
?
(
$rel_uri
,
$format
)
:
$rel_uri
;
...
...
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