Skip to content

fix(files_external): reject backend changes when updating mounts - #64456

Draft
joshtrichards wants to merge 4 commits into
masterfrom
jtr/fix-StoragesService-updates
Draft

joshtrichards wants to merge 4 commits into
masterfrom
jtr/fix-StoragesService-updates

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Backend changes (for example, DAV-->SMB) are not currently supported or persisted by StoragesService::updateStorage(), but they are currently accepted.

The web frontend provides some protection by disabling the backend dropdown when editing an existing mount, but the HTTP API has no equivalent safeguard.

This PR rejects backend changes before writing any mount configuration, enforcing this server-side so the behavior is consistent regardless of the caller. This prevents partially applied updates that could combine the existing backend with options intended for a different backend.

First commit is all just some clarifying comments/docs covering some important bits.

Second commit is the actual fix and it's only two lines of code.

A future follow-up idea: there may be a related concern in files_external:import.

TODO

  • Test coverage

Checklist

AI (if applicable)

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

@joshtrichards joshtrichards added this to the Nextcloud 36 milestone Sep 17, 2026
@joshtrichards
joshtrichards added this pull request to stack #64458 September 17, 2026 03:40
…anges

Signed-off-by: Josh <josh.t.richards@gmail.com>
Backend changes (for example, DAV → SMB) are not currently supported or persisted by `StoragesService::updateStorage()`, but they are currently
accepted.

The web frontend provides some protection by disabling the backend dropdown when editing an existing mount, but the HTTP API has no equivalent safeguard.

Reject backend changes before writing any mount configuration, enforcing this server-side so the behavior is consistent regardless of the caller. This prevents partially applied updates that could combine the existing backend with options intended for a different backend.

Signed-off-by: Josh <josh.t.richards@gmail.com>
`StoragesService::updateStorage()` accepted updated priority values but never persisted them. As a result, changing a mount's priority appeared to succeed but was lost when the mount was reloaded.

This is currently primarily a concern for the HTTP API: the web UI does not expose priority, while `files_external:import` creates new mounts and its
parser does not currently import priority values (imported mounts receive the default priority).

Persist priority changes passed to `updateStorage()` so updated precedence is retained for overlapping external storage mounts.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Will do in its own PR.

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards
joshtrichards force-pushed the jtr/fix-StoragesService-updates branch from d455080 to 5c61b20 Compare September 17, 2026 03:41

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant