Made the transaction date parser a bit more strict
This commit is contained in:
parent
41212cd4c1
commit
38e165a994
1 changed files with 12 additions and 9 deletions
|
|
@ -118,6 +118,8 @@ void item_t::set_tag(const string& tag,
|
||||||
void item_t::parse_tags(const char * p, optional<date_t::year_type> current_year)
|
void item_t::parse_tags(const char * p, optional<date_t::year_type> current_year)
|
||||||
{
|
{
|
||||||
if (const char * b = std::strchr(p, '[')) {
|
if (const char * b = std::strchr(p, '[')) {
|
||||||
|
if (*(b + 1) != '\0' &&
|
||||||
|
(std::isdigit(*(b + 1)) || *(b + 1) == '=')) {
|
||||||
if (const char * e = std::strchr(p, ']')) {
|
if (const char * e = std::strchr(p, ']')) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
std::strncpy(buf, b + 1, e - b - 1);
|
std::strncpy(buf, b + 1, e - b - 1);
|
||||||
|
|
@ -131,6 +133,7 @@ void item_t::parse_tags(const char * p, optional<date_t::year_type> current_year
|
||||||
_date = parse_date(buf, current_year);
|
_date = parse_date(buf, current_year);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! std::strchr(p, ':'))
|
if (! std::strchr(p, ':'))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue