-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Ignore shared Collective mounts when scanning files #42497
base: master
Are you sure you want to change the base?
Conversation
/backport to stable28 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change, looks good to me :)
Fast review ~! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but let's wait for @max-nextcloud or @mejo- input :)
@mejo- is the better person when it comes to backend changes. I have some uninformed questions though...
In general it seems not ideal to me to have collectives specific code in server. I wonder if we could instead make |
I remember that collectives storage was designed closely to what groupfolders does. Does this issue not occur with groupfolders ? How is the groupfolders implementation different from collectives? |
I tested this case and had no problem without Collectives installed, since But I agree it would be better not to rely on multiple classes here but instead have a common method which can be used. Maybe adding a method
However this would involve substantial refactoring of the backend code.
I refer to a normal collective which is shared with multiple members of a circle. |
@max-nextcloud @mejo- any update? |
Signed-off-by: Arno Welzel <[email protected]>
Signed-off-by: Arno Welzel <[email protected]>
4f8cde2
to
6c9178f
Compare
@arnowelzel psalm said no |
Since using the class name of the Collective storage is not possible in any way without triggering a psalm error (even when the class exists it is not allowed as parameter for // don't scan received local shares or collectives, these can be scanned when scanning the owner's storage
if (substr($storage->getId(), 0, 6) !== 'home::') {
continue;
} The idea here is, that only home storages should get scanned. Recieved shared storage start with I also noticed the following code in public function getScanner($path = '', $storage = null): Scanner {
if (!$storage) {
$storage = $this;
}
if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
// NoopScanner is private API and kept here for compatibility with older releases
$storage->scanner = class_exists(NoopScanner::class) ? new NoopScanner($storage) : new ObjectStoreScanner($storage);
} elseif (!isset($storage->scanner)) {
$storage->scanner = new Scanner($storage);
}
return $storage->scanner;
} |
Probably @icewind1991 is the best to decide whether it's a good idea to limit scanning to |
// don't scan received local shares, these can be scanned when scanning the owner's storage | ||
if ($storage->instanceOfStorage(SharedStorage::class)) { | ||
// don't scan received local shares or collectives, these can be scanned when scanning the owner's storage | ||
if (substr($storage->getId(), 0, 6) !== 'home::') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break scanning of external storages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What ID do external storages have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they all have different prefixes, in general attempts to filter by storage id is imprecise at best.
What is stopping the collectives from being scanned correctly in the first place? |
They are shared storages like |
If they can't be scanned at all then having them use |
Well - |
Right, it got moved to |
It seems, this is what Collectives is using right now - but it does not work. See https://github.com/nextcloud/collectives/blob/main/lib/Mount/CollectiveStorage.php#L62-L74: public function getScanner($path = '', $storage = null): Scanner {
if (!$storage) {
$storage = $this;
}
if ($storage->instanceOfStorage(ObjectStoreStorage::class)) {
// NoopScanner is private API and kept here for compatibility with older releases
$storage->scanner = class_exists(NoopScanner::class) ? new NoopScanner($storage) : new ObjectStoreScanner($storage);
} elseif (!isset($storage->scanner)) {
$storage->scanner = new Scanner($storage);
}
return $storage->scanner;
} |
Summary
When scanning files using
occ files:scan
, shared Collective mounts trigger "Path not found" error messages. This change will make sure that that Collective mounts will be ignored.Checklist