Skip to content

Rescan external storage shares on missing metadata - #63254

Open
pdostal wants to merge 1 commit into
nextcloud:masterfrom
pdostal:share_refresh
Open

Rescan external storage shares on missing metadata#63254
pdostal wants to merge 1 commit into
nextcloud:masterfrom
pdostal:share_refresh

Conversation

@pdostal

@pdostal pdostal commented Aug 14, 2026

Copy link
Copy Markdown

Summary

SharedStorage::getWatcher() decided between a real Watcher and a
NullWatcher purely from the share's node cache entry storage_string_id.
When that metadata was null or missing the key (e.g. shares fetched via
DefaultShareProvider::getSharesBy()/getShareById()/getSharesByPath(),
or not yet scanned at share-fetch time), it silently assumed home storage
and installed a NullWatcher, so re-shares of external storage (SMB, S3,
etc.) never got rescanned for the recipient.

This falls back to a live check of the real underlying storage
(instanceOfStorage(IHomeStorage::class)) when the metadata is missing or
incomplete, mirroring the existing fallback in getSourceRootInfo(). A
FailedStorage guard keeps a deleted owner/offline storage safely on
NullWatcher.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

SharedStorage::getWatcher() decided between a real Watcher and a
NullWatcher purely from the share's node cache entry storage_string_id.
When that metadata was null or missing the key (e.g. shares fetched via
DefaultShareProvider::getSharesBy()/getShareById()/getSharesByPath(), or
not yet scanned at share-fetch time), it silently assumed home storage
and installed a NullWatcher, so re-shares of external storage (SMB, S3,
etc.) never got rescanned for the recipient.

Fall back to a live check of the real underlying storage
(instanceOfStorage(IHomeStorage::class)) when the metadata is missing or
incomplete, mirroring the existing fallback in getSourceRootInfo(). A
FailedStorage guard keeps a deleted owner/offline storage safely on
NullWatcher.

Fixes nextcloud#63253

Assisted-by: OpenCode:claude-sonnet-5
Signed-off-by: Pavel Dostál <pdostal@suse.cz>
@pdostal
pdostal requested a review from a team as a code owner August 14, 2026 23:56
@pdostal
pdostal requested review from Altahrim, CarlSchwan, icewind1991 and provokateurin and removed request for a team August 14, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-shared external storage (SMB) not always rescanned for recipients

1 participant