@@ -1631,6 +1631,14 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
16311631 return ;
16321632 }
16331633
1634+ // The move target is in a read-only folder so it can't be uploaded, but its data is safe
1635+ // at the source (restored below). Emitting remnantReadOnlyFolderDiscovered() schedules this
1636+ // local copy for deletion at the end of the sync, removing the duplicate. A genuinely new
1637+ // local file never reaches this move branch and is kept by checkPermissions (#7797/#10099).
1638+ if (!localEntry.isVirtualFile && item->_instruction == CSYNC_INSTRUCTION_IGNORE ) {
1639+ emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
1640+ }
1641+
16341642 // Here we know the new location can't be uploaded: must prevent the source delete.
16351643 // Two cases: either the source item was already processed or not.
16361644 auto wasDeletedOnClient = _discoveryData->findAndCancelDeletedJob (originalPath);
@@ -2011,13 +2019,15 @@ bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item)
20112019 qCWarning (lcDisco) << " checkForPermission: Not allowed because you don't have permission to add subfolders to that folder:" << item->_file ;
20122020 item->_instruction = CSYNC_INSTRUCTION_IGNORE ;
20132021 item->_errorString = tr (" Not allowed because you don't have permission to add subfolders to that folder" );
2014- emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
2022+ // Do NOT schedule the new local folder for deletion: it may contain data the user just
2023+ // created and that exists nowhere else. (see read-only folder regression, issues #7797/#10099).
20152024 return false ;
20162025 } else if (!item->isDirectory () && !perms.hasPermission (RemotePermissions::CanAddFile)) {
20172026 qCWarning (lcDisco) << " checkForPermission: Not allowed because you don't have permission to add files in that folder:" << item->_file ;
20182027 item->_instruction = CSYNC_INSTRUCTION_IGNORE ;
20192028 item->_errorString = tr (" Not allowed because you don't have permission to add files in that folder" );
2020- emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
2029+ // Do NOT schedule the new local file for deletion: it may be data the user just created
2030+ // and that exists nowhere else. (see read-only folder regression, issues #7797/#10099).
20212031 return false ;
20222032 }
20232033 break ;
0 commit comments