Ever since implementing URI matching (see a864366e60f6e7ae67df91010d7e30f3b1569ac0) trying to get entries containing a colon : in the name field fails.
Example
$ rbw list
...
Example: not an URI
...
$ rbw get 'Example: not an URI'
rbw get: couldn't find entry for 'example: not an URI': no entry found
Note how the error message lower cases the string preceding the colon.
More details
Separating "Example" from the colon in the name yields the desired results:
$ rbw list
...
Example : not an URI
...
$ rbw get 'Example : not an URI'
secret
Cause
After digging through the code and having a play with Rusts url crate I'm pretty sure the issue lies in the usage of Url::parse() in parse_needle() to determine if the given string is (an UUID,) an URL or just a name.
I can't think of a good solution to the problem other than maybe implementing a fallback mechanism that treats the first argument given to get as name when an URL (according to Url::parse()) is detected but no entry with this URL is found.
Ever since implementing URI matching (see a864366e60f6e7ae67df91010d7e30f3b1569ac0) trying to get entries containing a colon
:
in the name field fails.Example
Note how the error message lower cases the string preceding the colon.
More details
Separating "Example" from the colon in the name yields the desired results:
Cause
After digging through the code and having a play with Rusts
url
crate I'm pretty sure the issue lies in the usage ofUrl::parse()
inparse_needle()
to determine if the given string is (an UUID,) an URL or just a name.https://github.com/doy/rbw/blob/f0b79695ca1c65b6e9510f30a88683220b9e5eb6/src/bin/rbw/commands.rs#L37-L46
Url::parse()
seems to returnOk
for every string not containing any whitespace that is followed by a colon and optional text.Here's a link to Rust Playground containing some example strings to run throug
Url::parse()
: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4b84a31eaa0520308fcf6c6a0095f6e9Possible solution
I can't think of a good solution to the problem other than maybe implementing a fallback mechanism that treats the first argument given to
get
as name when an URL (according toUrl::parse()
) is detected but no entry with this URL is found.