mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #3246 from nextcloud/bugfix/vfs-allow-dyhadration-of-readonly-files
VFS. Allow dehydartion of readonly files. Preserve 'readonly' flag when creating a placeholder.
This commit is contained in:
commit
539b45a346
@ -427,6 +427,12 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
|
||||
}
|
||||
propagator()->_journal->deleteFileRecord(_item->_originalFile);
|
||||
updateMetadata(false);
|
||||
|
||||
if (!_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanWrite)) {
|
||||
// make sure ReadOnly flag is preserved for placeholder, similarly to regular files
|
||||
FileSystem::setFileReadOnly(propagator()->fullLocalPath(_item->_file), true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (vfs->mode() == Vfs::Off && _item->_type == ItemTypeVirtualFile) {
|
||||
@ -446,6 +452,12 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
|
||||
return;
|
||||
}
|
||||
updateMetadata(false);
|
||||
|
||||
if (!_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanWrite)) {
|
||||
// make sure ReadOnly flag is preserved for placeholder, similarly to regular files
|
||||
FileSystem::setFileReadOnly(propagator()->fullLocalPath(_item->_file), true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ Result<void, QString> VfsCfApi::dehydratePlaceholder(const SyncFileItem &item)
|
||||
{
|
||||
const auto previousPin = pinState(item._file);
|
||||
|
||||
if (!QFile::remove(_setupParams.filesystemPath + item._file)) {
|
||||
if (!FileSystem::remove(_setupParams.filesystemPath + item._file)) {
|
||||
return QStringLiteral("Couldn't remove %1 to fulfill dehydration").arg(item._file);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user