@@ -1637,6 +1637,14 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
16371637 return ;
16381638 }
16391639
1640+ // The move target is in a read-only folder so it can't be uploaded, but its data is safe
1641+ // at the source (restored below). Emitting remnantReadOnlyFolderDiscovered() schedules this
1642+ // local copy for deletion at the end of the sync, removing the duplicate. A genuinely new
1643+ // local file never reaches this move branch and is kept by checkPermissions (#7797/#10099).
1644+ if (!localEntry.isVirtualFile && item->_instruction == CSYNC_INSTRUCTION_IGNORE ) {
1645+ emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
1646+ }
1647+
16401648 // Here we know the new location can't be uploaded: must prevent the source delete.
16411649 // Two cases: either the source item was already processed or not.
16421650 auto wasDeletedOnClient = _discoveryData->findAndCancelDeletedJob (originalPath);
@@ -2017,13 +2025,15 @@ bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item)
20172025 qCWarning (lcDisco) << " checkForPermission: Not allowed because you don't have permission to add subfolders to that folder:" << item->_file ;
20182026 item->_instruction = CSYNC_INSTRUCTION_IGNORE ;
20192027 item->_errorString = tr (" Not allowed because you don't have permission to add subfolders to that folder" );
2020- emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
2028+ // Do NOT schedule the new local folder for deletion: it may contain data the user just
2029+ // created and that exists nowhere else. (see read-only folder regression, issues #7797/#10099).
20212030 return false ;
20222031 } else if (!item->isDirectory () && !perms.hasPermission (RemotePermissions::CanAddFile)) {
20232032 qCWarning (lcDisco) << " checkForPermission: Not allowed because you don't have permission to add files in that folder:" << item->_file ;
20242033 item->_instruction = CSYNC_INSTRUCTION_IGNORE ;
20252034 item->_errorString = tr (" Not allowed because you don't have permission to add files in that folder" );
2026- emit _discoveryData->remnantReadOnlyFolderDiscovered (item);
2035+ // Do NOT schedule the new local file for deletion: it may be data the user just created
2036+ // and that exists nowhere else. (see read-only folder regression, issues #7797/#10099).
20272037 return false ;
20282038 }
20292039 break ;
0 commit comments