ironthree / dxr

Declarative XML-RPC in Rust
Apache License 2.0
17 stars 8 forks source link

Strings handed to Call parameters get double escaped #5

Closed Belgabor closed 1 year ago

Belgabor commented 1 year ago

I need to pass an url with parameters via XML-RPC, unfortunately '&' gets double escaped.

let call: Call<_, i32> = Call::new("test", vec![Value::string("a&b")]);
client.call(call).await?;

From the server log:

<?xml version="1.0"?>
<methodCall>
  <methodName>test</methodName>
  <params>
    <param>
      <value>
        <string>a&amp;amp;b</string>
      </value>
    </param>
  </params>
</methodCall>
decathorpe commented 1 year ago

Huh, that does look wrong :( I'm pretty sure quick-xml didn't do automatic escaping of strings when I wrote the initial implementation, but it looks like it definitely does do now ... I'll look into it. I might be able to drop the manual escaping code if quick-xml now handles this internally

decathorpe commented 1 year ago

I've dropped the code that caused the duplicate (un)escaping and added two small test cases to ensure this won't happen again by accident. I released a new version of the v0.5 branch (v0.5.4), which should be available from crates.io any second now. I'll now forward port this fix to the main branch as well. Thanks for the report!