Prevent use of invalid characters for file provider domain names

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-04-23 21:59:45 +08:00 committed by Camila Ayres
parent 8f6c19e029
commit 591d5eebd2

View file

@ -16,6 +16,7 @@
#import <FileProvider/FileProvider.h> #import <FileProvider/FileProvider.h>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QRegularExpression>
#include "config.h" #include "config.h"
#include "fileproviderdomainmanager.h" #include "fileproviderdomainmanager.h"
@ -31,7 +32,8 @@ namespace {
QString domainIdentifierForAccount(const OCC::Account * const account) QString domainIdentifierForAccount(const OCC::Account * const account)
{ {
Q_ASSERT(account); Q_ASSERT(account);
return account->userIdAtHostWithPort(); static const QRegularExpression illegalChars("[:/]");
return account->userIdAtHostWithPort().replace(illegalChars, "-");
} }
QString domainIdentifierForAccount(const OCC::AccountPtr account) QString domainIdentifierForAccount(const OCC::AccountPtr account)