robertodoering / dart_mpd

dart mpd client
MIT License
4 stars 0 forks source link

Automatic escaping didn't support filter value with quote (") #7

Closed semutKecil closed 4 months ago

semutKecil commented 4 months ago

I found that automatic escaping in version 0.4.1 didn't support filter value that contain special character like double quote (")

This is error log from my app.

I/flutter (18927): list "albumartist" "(album == \"Album title with quote \"Album\"\")"
I/flutter (18927): MpdResponse.error(message: [2@0] {list} ')' expected)
E/flutter (18927): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MpdResponse.error(message: [2@0] {list} ')' expected)

Since filter value already wrapped with double quote(") it need to be escaped with \\\"

invalid command list "albumartist" "(album == \"Album title with quote \"Album\"\")"

expected command list "albumartist" "(album == \"Album title with quote \\\"Album\\\"\")"

For now i just escape filter value manually and it works. I think it's ok to leave it as it is, add bit explanation in the doc are enough.

robertodoering commented 4 months ago

Yes that's right, the arguments within a search query aren't automatically escaped yet.

I plan to eventually add a proper query builder for the search request to make it easier to use. Until then I'll keep it as it is.

I've updated the readme to explain that queries are not escaped automatically.

Thanks for the hint, I'll close this issue now.