mirror of
https://git.deuxfleurs.fr/Deuxfleurs/garage.git
synced 2024-11-25 09:31:00 +00:00
add application/xml header and missing xml escapes
This commit is contained in:
parent
0ddfee92c5
commit
1de96248e0
3 changed files with 11 additions and 5 deletions
|
@ -103,5 +103,7 @@ pub async fn handle_copy(
|
|||
writeln!(&mut xml, "\t<LastModified>{}</LastModified>", last_modified).unwrap();
|
||||
writeln!(&mut xml, "</CopyObjectResult>").unwrap();
|
||||
|
||||
Ok(Response::new(Body::from(xml.into_bytes())))
|
||||
Ok(Response::builder()
|
||||
.header("Content-Type", "application/xml")
|
||||
.body(Body::from(xml.into_bytes()))?)
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ pub async fn handle_delete_objects(
|
|||
match handle_delete_internal(&garage, bucket, &obj.key).await {
|
||||
Ok((deleted_version, delete_marker_version)) => {
|
||||
writeln!(&mut retxml, "\t<Deleted>").unwrap();
|
||||
writeln!(&mut retxml, "\t\t<Key>{}</Key>", obj.key).unwrap();
|
||||
writeln!(&mut retxml, "\t\t<Key>{}</Key>", xml_escape(&obj.key)).unwrap();
|
||||
writeln!(
|
||||
&mut retxml,
|
||||
"\t\t<VersionId>{}</VersionId>",
|
||||
|
@ -104,7 +104,7 @@ pub async fn handle_delete_objects(
|
|||
Err(e) => {
|
||||
writeln!(&mut retxml, "\t<Error>").unwrap();
|
||||
writeln!(&mut retxml, "\t\t<Code>{}</Code>", e.http_status_code()).unwrap();
|
||||
writeln!(&mut retxml, "\t\t<Key>{}</Key>", obj.key).unwrap();
|
||||
writeln!(&mut retxml, "\t\t<Key>{}</Key>", xml_escape(&obj.key)).unwrap();
|
||||
writeln!(
|
||||
&mut retxml,
|
||||
"\t\t<Message>{}</Message>",
|
||||
|
@ -118,7 +118,9 @@ pub async fn handle_delete_objects(
|
|||
|
||||
writeln!(&mut retxml, "</DeleteObjectsOutput>").unwrap();
|
||||
|
||||
Ok(Response::new(Body::from(retxml.into_bytes())))
|
||||
Ok(Response::builder()
|
||||
.header("Content-Type", "application/xml")
|
||||
.body(Body::from(retxml.into_bytes()))?)
|
||||
}
|
||||
|
||||
struct DeleteRequest {
|
||||
|
|
|
@ -271,5 +271,7 @@ pub async fn handle_list(
|
|||
writeln!(&mut xml, "</ListBucketResult>").unwrap();
|
||||
debug!("{}", xml);
|
||||
|
||||
Ok(Response::new(Body::from(xml.into_bytes())))
|
||||
Ok(Response::builder()
|
||||
.header("Content-Type", "application/xml")
|
||||
.body(Body::from(xml.into_bytes()))?)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue