Merge pull request #7322 from nextcloud/bugfix/vfs-crash-socketcontroller

Fix crash caused due to null accountstate in FileProviderSocketController
This commit is contained in:
Claudio Cambra 2024-10-16 16:09:05 +08:00 committed by GitHub
commit e02cf85201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,19 @@ void FileProviderSocketController::parseReceivedLine(const QString &receivedLine
const auto argument = receivedLine.mid(argPos + 1);
if (command == QStringLiteral("FILE_PROVIDER_DOMAIN_IDENTIFIER_REQUEST_REPLY")) {
_accountState = FileProviderDomainManager::accountStateFromFileProviderDomainIdentifier(argument);
auto domainIdentifier = argument;
// Check if we have a port number who's colon has been replaced by a hyphen
// This is a workaround for the fact that we can't use colons as characters in domain names
// Let's check if, after the final hyphen, we have a number -- then it is a port number
const auto portColonPos = argument.lastIndexOf('-');
const auto possiblePort = argument.mid(portColonPos + 1);
auto validInt = false;
const auto port = possiblePort.toInt(&validInt);
if (validInt && port > 0) {
domainIdentifier.replace(portColonPos, 1, ':');
}
_accountState = FileProviderDomainManager::accountStateFromFileProviderDomainIdentifier(domainIdentifier);
sendAccountDetails();
reportSyncState("SYNC_PREPARING");
return;