From 97301e3a55eb560f5c5ec1879460d6fc30d76fe3 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 31 Aug 2023 13:36:10 +0800 Subject: [PATCH] Use a standardised locale to create log file filenames, fixing issues with certain locales Signed-off-by: Claudio Cambra --- src/libsync/logger.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index 7a050a103..2bfaa8aaf 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -289,8 +289,9 @@ void Logger::enterNextLogFileNoLock() } // Tentative new log name, will be adjusted if one like this already exists - QDateTime now = QDateTime::currentDateTime(); - QString newLogName = now.toString("yyyyMMdd_HHmm") + "_nextcloud.log"; + const auto now = QDateTime::currentDateTime(); + const auto cLocale = QLocale::c(); // Some system locales generate strings that are incompatible with filesystem + QString newLogName = cLocale.toString(now, QStringLiteral("yyyyMMdd_HHmm")) + QStringLiteral("_nextcloud.log"); // Expire old log files and deal with conflicts QStringList files = dir.entryList(QStringList("*owncloud.log.*"), QDir::Files, QDir::Name) +