Redact password from URL when displaying internal errors
This commit is contained in:
parent
239d751342
commit
745082f357
|
@ -12,6 +12,20 @@ using namespace Data;
|
|||
|
||||
namespace QtGui {
|
||||
|
||||
/*!
|
||||
* \brief Constructs a new error suitable for display purposes (password in \a url is redacted).
|
||||
*/
|
||||
InternalError::InternalError(const QString &message, const QUrl &url, const QByteArray &response)
|
||||
: message(message)
|
||||
, url(url)
|
||||
, response(response)
|
||||
, when(CppUtilities::DateTime::now())
|
||||
{
|
||||
if (!this->url.password().isEmpty()) {
|
||||
this->url.setPassword(QStringLiteral("redacted"));
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns whether the error is relevant. Only in this case a notification for the error should be shown.
|
||||
* \todo Unify with SyncthingNotifier::isDisconnectRelevant().
|
||||
|
|
|
@ -27,13 +27,6 @@ struct SYNCTHINGWIDGETS_EXPORT InternalError {
|
|||
CppUtilities::DateTime when;
|
||||
};
|
||||
|
||||
inline InternalError::InternalError(const QString &message, const QUrl &url, const QByteArray &response)
|
||||
: message(message)
|
||||
, url(url)
|
||||
, response(response)
|
||||
, when(CppUtilities::DateTime::now())
|
||||
{
|
||||
}
|
||||
} // namespace QtGui
|
||||
|
||||
#endif // SYNCTHINGWIDGETS_INTERNAL_ERROR_H
|
||||
|
|
Loading…
Reference in New Issue