aboutsummaryrefslogtreecommitdiff
path: root/src/api/encoding.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-05-03 22:45:42 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-06 22:37:15 +0200
commit6ccffc316228bb056fa135cc5fceb2ed75f545f5 (patch)
tree109e9334aaee5b7865a5d29fcfaea23010da0cc4 /src/api/encoding.rs
parente4b9e4e24d006373a20cfcbdac9dba5e399ee182 (diff)
downloadgarage-6ccffc316228bb056fa135cc5fceb2ed75f545f5.tar.gz
garage-6ccffc316228bb056fa135cc5fceb2ed75f545f5.zip
Improved XML serializationbetter_xml
- Use quick_xml and serde for all XML response returned by the S3 API. - Include tests for all structs used to generate XML - Remove old manual XML escaping function which was unsafe
Diffstat (limited to 'src/api/encoding.rs')
-rw-r--r--src/api/encoding.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/api/encoding.rs b/src/api/encoding.rs
index b3fbbe34..e286a784 100644
--- a/src/api/encoding.rs
+++ b/src/api/encoding.rs
@@ -1,13 +1,5 @@
//! Module containing various helpers for encoding
-/// Escape &str for xml inclusion
-pub fn xml_escape(s: &str) -> String {
- s.replace("&", "&amp;")
- .replace("<", "&lt;")
- .replace(">", "&gt;")
- .replace("\"", "&quot;")
-}
-
/// Encode &str for use in a URI
pub fn uri_encode(string: &str, encode_slash: bool) -> String {
let mut result = String::with_capacity(string.len() * 2);
@@ -28,12 +20,3 @@ pub fn uri_encode(string: &str, encode_slash: bool) -> String {
}
result
}
-
-/// Encode &str either as an uri, or a valid string for xml inclusion
-pub fn xml_encode_key(k: &str, urlencode: bool) -> String {
- if urlencode {
- uri_encode(k, true)
- } else {
- xml_escape(k)
- }
-}