mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug
- Disallowed @ and / from an attribute name or modifier. This causes input like 'user@host:path' to now be parsed as description, and not as an unrecognized attribute.
This commit is contained in:
parent
783a326b11
commit
036d77e08f
4 changed files with 39 additions and 23 deletions
14
src/Att.cpp
14
src/Att.cpp
|
@ -205,14 +205,18 @@ bool Att::valid (const std::string& input) const
|
|||
if (!n.getUntilOneOf (".:", ignored))
|
||||
return false;
|
||||
|
||||
if (n.skip (':') &&
|
||||
(n.getQuoted ('"', ignored) ||
|
||||
if (n.skip (':'))
|
||||
{
|
||||
if (input.find ('@') <= n.cursor () ||
|
||||
input.find ('/') <= n.cursor ())
|
||||
return false;
|
||||
|
||||
if (n.getQuoted ('"', ignored) ||
|
||||
n.getUntil (' ', ignored) ||
|
||||
n.getUntilEOS (ignored) ||
|
||||
n.depleted ()))
|
||||
n.depleted ())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -552,6 +552,12 @@ char Nibbler::next ()
|
|||
return '\0';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string::size_type Nibbler::cursor ()
|
||||
{
|
||||
return mCursor;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Peeks ahead - does not move cursor.
|
||||
std::string Nibbler::next (const int quantity)
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
char next ();
|
||||
std::string next (const int quantity);
|
||||
|
||||
std::string::size_type cursor ();
|
||||
|
||||
void save ();
|
||||
void restore ();
|
||||
|
||||
|
|
|
@ -34,12 +34,16 @@ Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (117);
|
||||
UnitTest t (121);
|
||||
|
||||
Att a;
|
||||
t.notok (a.valid ("name"), "Att::valid name -> fail");
|
||||
t.notok (a.valid (":"), "Att::valid : -> fail");
|
||||
t.notok (a.valid (":value"), "Att::valid :value -> fail");
|
||||
t.notok (a.valid ("n@me.mod:value"), "Att::valie n@me.mod:value -> fail");
|
||||
t.notok (a.valid ("n/me.mod:value"), "Att::valie n/me.mod:value -> fail");
|
||||
t.notok (a.valid ("name.m@d:value"), "Att::valie name.m@d:value -> fail");
|
||||
t.notok (a.valid ("name.m/d:value"), "Att::valie name.m/d:value -> fail");
|
||||
|
||||
t.ok (a.valid ("name:value"), "Att::valid name:value");
|
||||
t.ok (a.valid ("name:value "), "Att::valid name:value\\s");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue