mu-message-part: rework cooked_filename a bit

Improve working, add a 'minimal' mode, and add some unit tests.
This commit is contained in:
Dirk-Jan C. Binnema
2023-02-19 10:47:50 +02:00
parent 558745bf00
commit 6da223fcb6
4 changed files with 121 additions and 45 deletions

View File

@ -65,13 +65,16 @@ public:
/**
* Filename for the mime-part file. This is a "cooked" filename with
* unallowed characters removed. If there's no filename specified,
* construct one (such as in the case of MimeMessagePart).
* construct one (such as in the case of a MimeMessagePart).
*
* @param minimal if true, only perform *minimal* cookiing, where we
* only remove forward-slashes.
*
* @see raw_filename()
*
* @return the name
*/
Option<std::string> cooked_filename() const noexcept;
Option<std::string> cooked_filename(bool minimal=false) const noexcept;
/**
* Name for the mime-part file, i.e., MimePart::filename