From c9522fb740200ccef6230cec452c48efb31e5394 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 11 May 2023 22:05:17 +0200 Subject: Removed all Printf-family functions from StringUtils. Replaced them with fmt::format calls, including changes to the format strings. Also changed the format strings to use FMT_STRING, so that the format is checked compile-time against the arguments. Also fixed code-style violations already present in the code. --- src/WebAdmin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/WebAdmin.cpp') diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index a96472b04..39b935fbd 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -378,7 +378,7 @@ void cWebAdmin::HandleFileRequest(cHTTPServerConnection & a_Connection, cHTTPInc // Read the file contents and guess its mime-type, based on the extension: AString Content = "

404 Not Found

"; AString ContentType = "text/html"; - AString Path = Printf("webadmin/files/%s", FileURL.c_str()); + AString Path = "webadmin/files/" + FileURL; // Return 404 if the file is not found, or the URL contains '../' (for security reasons) if ((FileURL.find("../") == AString::npos) && cFile::IsFile(Path)) @@ -485,9 +485,9 @@ sWebAdminPage cWebAdmin::GetPage(const HTTPRequest & a_Request) page.ContentType = "text/html"; // Default to HTML content type, unless overridden by a plugin if (!tab->m_Callback->Call(a_Request, split[1], page.Content, page.ContentType)) { - page.Content = GetHTMLEscapedString(Printf( - "WebTab callback for plugin %s, page %s has failed.", - tab->m_PluginName.c_str(), tab->m_Title.c_str() + page.Content = GetHTMLEscapedString(fmt::format( + FMT_STRING("WebTab callback for plugin {}, page {} has failed."), + tab->m_PluginName, tab->m_Title )); } page.PluginName = tab->m_PluginName; -- cgit v1.2.3