Merge pull request #6012 from nextcloud/bugfix/fix-log-file-creation

Use a standardised locale to create log file filenames
This commit is contained in:
Claudio Cambra 2023-09-13 17:57:53 +08:00 committed by GitHub
commit e2bd6e506f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) +