Ignore shared Collective mounts when scanning files#42497
Ignore shared Collective mounts when scanning files#42497arnowelzel wants to merge 4 commits intonextcloud:masterfrom
Conversation
|
/backport to stable28 |
emoral435
left a comment
There was a problem hiding this comment.
Nice change, looks good to me :)
|
Fast review ~! |
There was a problem hiding this comment.
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.
This will break scanning of external storages.
There was a problem hiding this comment.
What ID do external storages have?
There was a problem hiding this comment.
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;
} |
|
Since no one has an idea about this I suggest to close this. The code is way outdated anyway. |
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