Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: False warning of duplicate sync connection with parent or child #7005

Closed
5 of 8 tasks
viharm opened this issue Aug 15, 2024 · 2 comments
Closed
5 of 8 tasks

[Bug]: False warning of duplicate sync connection with parent or child #7005

viharm opened this issue Aug 15, 2024 · 2 comments

Comments

@viharm
Copy link

viharm commented Aug 15, 2024

⚠️ Before submitting, please verify the following: ⚠️

Bug description

When creating a new sync connection, the Select a remote destination folder pop-up throws a false warning that the requested folder is either a parent or a child of another folder.
image

Steps to reproduce

  1. Add a connection to a path on the server that includes a keyword in the last stub of the path, e.g., /home/user/Nextcloud_Test.
  2. then add another connection on the server that has the exact keyword as the last stub of the path, e.g., /home/user/Nextcloud.

Expected behavior

The client should should not emit a warning

Which files are affected by this bug

Not sure

Operating system

Windows

Which version of the operating system you are running.

Windows 11

Package

Other

Nextcloud Server version

28.0.8

Nextcloud Desktop Client version

3.13.2

Is this bug present after an update or on a fresh install?

Fresh desktop client install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

  • Default internal user-backend
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Nextcloud Server logs

No response

Additional info

The destination path on the server is mapped to a SSH storage backend.

@joshtrichards
Copy link
Member

I guess we need to add a trailing slash to dir for the startsWith() check:

bool FolderWizardRemotePath::isComplete() const
{
if (!_ui.folderTreeWidget->currentItem())
return false;
QStringList warnStrings;
QString dir = _ui.folderTreeWidget->currentItem()->data(0, Qt::UserRole).toString();
if (!dir.startsWith(QLatin1Char('/'))) {
dir.prepend(QLatin1Char('/'));
}
wizard()->setProperty("targetPath", dir);
Folder::Map map = FolderMan::instance()->map();
Folder::Map::const_iterator i = map.constBegin();
for (i = map.constBegin(); i != map.constEnd(); i++) {
auto *f = static_cast<Folder *>(i.value());
if (f->accountState()->account() != _account) {
continue;
}
QString curDir = f->remotePathTrailingSlash();
if (QDir::cleanPath(dir) == QDir::cleanPath(curDir)) {
warnStrings.append(tr("This folder is already being synced."));
} else if (dir.startsWith(curDir)) {
warnStrings.append(tr("You are already syncing <i>%1</i>, which is a parent folder of <i>%2</i>.").arg(Utility::escape(curDir), Utility::escape(dir)));
} else if (curDir.startsWith(dir)) {
warnStrings.append(tr("You are already syncing <i>%1</i>, which is a subfolder of <i>%2</i>.").arg(Utility::escape(curDir), Utility::escape(dir)));
}
}

@camilasan
Copy link
Member

We have fixed this with #7636 and #7596.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants