mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Task: Corrected str_replace calls
This commit is contained in:
parent
7a43183a3f
commit
0fecb26536
1 changed files with 6 additions and 17 deletions
23
src/Task.cpp
23
src/Task.cpp
|
@ -1643,12 +1643,8 @@ void Task::validate_before (const std::string& left, const std::string& right)
|
||||||
// ] -> &close;
|
// ] -> &close;
|
||||||
const std::string Task::encode (const std::string& value) const
|
const std::string Task::encode (const std::string& value) const
|
||||||
{
|
{
|
||||||
std::string modified = value;
|
auto modified = str_replace (value, "[", "&open;");
|
||||||
|
return str_replace (modified, "]", "&close;");
|
||||||
str_replace (modified, "[", "&open;");
|
|
||||||
str_replace (modified, "]", "&close;");
|
|
||||||
|
|
||||||
return modified;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1661,18 +1657,11 @@ const std::string Task::encode (const std::string& value) const
|
||||||
// : <- :
|
// : <- :
|
||||||
const std::string Task::decode (const std::string& value) const
|
const std::string Task::decode (const std::string& value) const
|
||||||
{
|
{
|
||||||
if (value.find ('&') != std::string::npos)
|
if (value.find ('&') == std::string::npos)
|
||||||
{
|
|
||||||
std::string modified = value;
|
|
||||||
|
|
||||||
// Supported encodings.
|
|
||||||
str_replace (modified, "&open;", "[");
|
|
||||||
str_replace (modified, "&close;", "]");
|
|
||||||
|
|
||||||
return modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
|
auto modified = str_replace (value, "&open;", "[");
|
||||||
|
return str_replace (modified, "&close;", "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue