Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gui/activity/activitydata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <QtCore>

Check failure on line 7 in src/gui/activity/activitydata.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/activity/activitydata.cpp:7:10 [clang-diagnostic-error]

'QtCore' file not found

#include "activitydata.h"
#include "folderman.h"
Expand Down Expand Up @@ -178,7 +178,7 @@
QString Activity::relativeServerFileTypeIconPath(const QMimeType &mimeType)
{
const auto iconPath = QStringLiteral("/index.php/apps/theming/img/core/filetypes/");
const auto defaultIcon = iconPath + QStringLiteral("file.svg");
const QString defaultIcon = iconPath + QStringLiteral("file.svg");

Check warning on line 181 in src/gui/activity/activitydata.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/activity/activitydata.cpp:181:19 [cppcoreguidelines-init-variables]

variable 'defaultIcon' is not initialized
if (!mimeType.isValid()) {
return defaultIcon;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
Expand Down Expand Up @@ -283,7 +283,7 @@

void GeneralSettings::confirmDisableFileProviderMode()
{
const auto text = tr("File Provider will be turned off for all accounts, and your files will no longer be available in Finder under the \"Locations\" section.")
const QString text = tr("File Provider will be turned off for all accounts, and your files will no longer be available in Finder under the \"Locations\" section.")
+ QStringLiteral("\n\n")
+ tr("Items that were not uploaded yet will be preserved and shown to you. Classic sync folders are not set up again automatically — you can add folder sync connections afterwards in each account's settings.");

Expand Down
4 changes: 2 additions & 2 deletions src/gui/notificationsoundplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ QString extractQrcToCache(const QString &qrcResourcePath)
fingerprint += QByteArray::number(bytes.size());
const auto hash = QCryptographicHash::hash(fingerprint, QCryptographicHash::Sha1).toHex();

const auto cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/sounds");
const QString cacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/sounds");
const auto suffix = QFileInfo(qrcResourcePath).suffix();
const auto dottedSuffix = suffix.isEmpty() ? QString() : QStringLiteral(".") + suffix;
const auto destinationPath = cacheDir + QStringLiteral("/") + QString::fromLatin1(hash) + dottedSuffix;
const QString destinationPath = cacheDir + QStringLiteral("/") + QString::fromLatin1(hash) + dottedSuffix;

if (QFile::exists(destinationPath)) {
extractedPaths.insert(qrcResourcePath, destinationPath);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/tray/usermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "activity/notificationhandler.h"

Check failure on line 6 in src/gui/tray/usermodel.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/tray/usermodel.cpp:6:10 [clang-diagnostic-error]

'activity/notificationhandler.h' file not found
#include "trayaccountmenupolicy.h"
#include "usermodel.h"
#include "common/filesystembase.h"
Expand Down Expand Up @@ -945,7 +945,7 @@
// user-visible refusal can produce many `reportInsufficientQuotaForItem` calls. Dedupe
// per (domain, relativePath) so the activity list shows one row per affected file rather
// than one per retry. See https://github.com/nextcloud/desktop/issues/9598.
const auto dedupKey = domainIdentifier + QLatin1Char('|') + relativePath;
const QString dedupKey = domainIdentifier + QLatin1Char('|') + relativePath;
if (_reportedQuotaItems.contains(dedupKey)) {
qCDebug(lcActivity) << "Suppressing duplicate quota-item entry for" << relativePath << "in domain" << domainIdentifier;
return;
Expand Down Expand Up @@ -1043,7 +1043,7 @@
// Re-arm dedupe so the next quota event for this domain produces a fresh summary entry
// and fresh per-item entries (one per affected file, not one per retry).
_reportedQuotaSummaryDomains.remove(domainIdentifier);
const auto domainPrefix = domainIdentifier + QLatin1Char('|');
const QString domainPrefix = domainIdentifier + QLatin1Char('|');
QMutableSetIterator<QString> it(_reportedQuotaItems);
while (it.hasNext()) {
if (it.next().startsWith(domainPrefix)) {
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/discoveryphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void DiscoverySingleLocalDirectoryJob::run() {

// Access lock state on the worker thread so a blocking open cannot freeze the GUI #10464
if (!i.isSymLink && !i.isVirtualFile && !i.isDirectory) {
const auto absoluteLocalPath = localPath + QLatin1Char('/') + i.name;
const QString absoluteLocalPath = localPath + QLatin1Char('/') + i.name;
i.isLocked = FileSystem::isFileLocked(absoluteLocalPath, FileSystem::LockMode::SharedRead);
qCDebug(lcDiscovery) << "File" << absoluteLocalPath << "isLocked" << i.isLocked;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
// Adobe lock files (.idlk / .prlock) are identified by extension, not prefix.
const auto suffix = QFileInfo{pathSplit.last()}.suffix().toLower().toStdString();
if (adobeLockFileDocumentExtensions.contains(suffix)) {
const auto pattern = QStringLiteral(".") + QString::fromStdString(suffix);
const QString pattern = QStringLiteral(".") + QString::fromStdString(suffix);

Check warning on line 246 in src/libsync/filesystem.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/filesystem.cpp:246:23 [cppcoreguidelines-init-variables]

variable 'pattern' is not initialized
qCDebug(OCC::lcFileSystem) << "Found an Adobe lock file with extension:" << pattern << "in path:" << path;
return pattern;
}
Expand Down
40 changes: 40 additions & 0 deletions test/testlockedfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* any purpose.
*/

#include <QtTest>

Check failure on line 11 in test/testlockedfiles.cpp

View workflow job for this annotation

GitHub Actions / build

test/testlockedfiles.cpp:11:10 [clang-diagnostic-error]

'QtTest' file not found
#include <QDir>
#include "syncenginetestutils.h"
#include "lockwatcher.h"
Expand Down Expand Up @@ -131,6 +131,46 @@
QVERIFY(tmp.remove());
}

// Functional check for local directory discovery #10535: DiscoverySingleLocalDirectoryJob
// must return every regular file and subdirectory with its name and flags intact.
void testLocalDirectoryDiscoveryReturnsAllEntries()
{
QTemporaryDir tmp;
QVERIFY(tmp.isValid());
QStringList expectedFiles;
for (int i = 0; i < 50; ++i) {
// Varied lengths and non ascii, matching the discovery concat path.
const QString name = QStringLiteral("entry_%1_ααβγ_%2.txt").arg(i).arg(QString(i % 20, QChar('x')));
QFile file(tmp.filePath(name));
QVERIFY(file.open(QIODevice::WriteOnly));
file.write("data");
expectedFiles.append(name);
}
QVERIFY(QDir(tmp.path()).mkdir(QStringLiteral("subdir")));

const auto job = new DiscoverySingleLocalDirectoryJob({}, tmp.path(), nullptr, false);
QSignalSpy finishedSpy(job, &DiscoverySingleLocalDirectoryJob::finished);
QThreadPool::globalInstance()->start(job);
QTRY_COMPARE_WITH_TIMEOUT(finishedSpy.count(), 1, 5000);

const auto results = finishedSpy.takeFirst().at(0).value<QVector<OCC::LocalInfo>>();
QCOMPARE(results.size(), expectedFiles.size() + 1);

QStringList seenFiles;
for (const auto &info : results) {
QVERIFY(!info.name.isEmpty());
if (info.isDirectory) {
QCOMPARE(info.name, QStringLiteral("subdir"));
continue;
}
QVERIFY(!info.isLocked);
seenFiles.append(info.name);
}
seenFiles.sort();
expectedFiles.sort();
QCOMPARE(seenFiles, expectedFiles);
}

#ifdef Q_OS_WIN
void testLockDetectionUsesRealFileSystemCheck()
{
Expand Down
Loading