mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Feature #881
* Output of URIs (during merge, pull, push) now omits passwords.
This commit is contained in:
parent
93337f499e
commit
ea44eaac1c
5 changed files with 28 additions and 3 deletions
24
src/Uri.cpp
24
src/Uri.cpp
|
@ -189,6 +189,30 @@ bool Uri::expand (const std::string& configPrefix )
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string Uri::ToString ()
|
||||
{
|
||||
if (!_parsed)
|
||||
return std::string ();
|
||||
|
||||
std::string result;
|
||||
// strip password from _user
|
||||
std::string::size_type pos = _user.find (":");
|
||||
result = _protocol + "://";
|
||||
|
||||
if (_user.length () > 0)
|
||||
result += _user.substr (0, pos) + "@";
|
||||
|
||||
result += _host;
|
||||
|
||||
if (_port.length () > 0)
|
||||
result += + ":" + _port;
|
||||
|
||||
result += "/" + _path;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Uri::parse ()
|
||||
{
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
std::string name () const;
|
||||
std::string parent () const;
|
||||
std::string extension () const;
|
||||
std::string ToString();
|
||||
bool is_directory () const;
|
||||
bool is_local () const;
|
||||
bool append (const std::string&);
|
||||
|
|
|
@ -97,7 +97,7 @@ int CmdMerge::execute (std::string& output)
|
|||
if (tmpfile != "")
|
||||
remove (tmpfile.c_str ());
|
||||
|
||||
if (((sAutopush == "ask") && (confirm (format (STRING_CMD_MERGE_CONFIRM, uri._data))))
|
||||
if (((sAutopush == "ask") && (confirm (format (STRING_CMD_MERGE_CONFIRM, uri.ToString ()))))
|
||||
|| (bAutopush))
|
||||
{
|
||||
// Derive autopush uri from merge.default.uri? otherwise: change prompt above
|
||||
|
|
|
@ -112,7 +112,7 @@ int CmdPull::execute (std::string& output)
|
|||
}
|
||||
}
|
||||
|
||||
output += format (STRING_CMD_PULL_TRANSFERRED, uri._data) + "\n";
|
||||
output += format (STRING_CMD_PULL_TRANSFERRED, uri.ToString ()) + "\n";
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_CMD_PULL_NO_URI);
|
||||
|
|
|
@ -96,7 +96,7 @@ int CmdPush::execute (std::string& output)
|
|||
ofile3 << ifile3.rdbuf();
|
||||
}
|
||||
|
||||
output += format (STRING_CMD_PUSH_TRANSFERRED, uri._data) + "\n";
|
||||
output += format (STRING_CMD_PUSH_TRANSFERRED, uri.ToString ()) + "\n";
|
||||
}
|
||||
else
|
||||
throw std::string (STRING_CMD_PUSH_NO_URI);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue