feat(files_sharing): configure public share link base URL#62146
Open
camr0 wants to merge 8 commits into
Open
Conversation
camr0
force-pushed
the
public-share-base-url
branch
from
July 22, 2026 05:53
838a43c to
9df6210
Compare
camr0
added a commit
to camr0/documentation
that referenced
this pull request
Jul 22, 2026
Documentation for nextcloud/server#62146 Signed-off-by: Ali Aslam <ali.aslam@zohomail.com> Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
4 tasks
Author
|
Documentation added in nextcloud/documentation#15361 |
camr0
marked this pull request as ready for review
July 22, 2026 07:15
camr0
requested review from
come-nc,
kristian-zendato,
leftybournes,
nfebe and
sorbaugh
and removed request for
a team
July 22, 2026 07:15
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9df62106ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Assisted-by: Codex:GPT-5 Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Assisted-by: Codex:GPT-5 Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Assisted-by: Codex:GPT-5 Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Assisted-by: Codex:GPT-5 Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Build the share link path through the router instead of hardcoding
'/s/{token}' so instances without pretty URLs keep their '/index.php'
front controller prefix when a custom base URL is configured. The
instance webroot is still replaced by the configured base URL.
Also trim surrounding whitespace from the configured value and log a
warning (once per process) when a non-empty value is rejected, instead
of falling back silently.
Assisted-by: ClaudeCode:kimi-k3[1m]
Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
The share notification and note emails still built the share link with the instance URL generator, so recipients received links pointing at the internal host even when shareapi_public_link_base_url was set. Generate them through PublicShareUrlGenerator like the other public share links. Assisted-by: ClaudeCode:kimi-k3[1m] Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Assisted-by: ClaudeCode:kimi-k3[1m] Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
Wrap Server::get(ShareByMailProvider::class) in a try/catch so that if the provider's dependencies cannot be resolved (e.g. PublicShareUrlGenerator from files_sharing is not autoloaded when the app is disabled), the provider factory falls back to null instead of throwing, matching the pattern already used for registered share providers. Assisted-by: ClaudeCode:kimi-k3[1m] Signed-off-by: Ali Aslam <ali.aslam@zohomail.com>
camr0
force-pushed
the
public-share-base-url
branch
from
July 22, 2026 07:51
9df6210 to
eded848
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional 'shareapi_public_link_base_url' config flag to set a custom base URL just for share links. When unset, Nextcloud behaves exactly the same.
The new "PublicShareUrlGenerator" reads the config value and validates that it's a valid HTTP(S) URL. If it's unset or if the URL is invalid, we fall back to Nextcloud's existing URL generator. Existing references to the current URL generator are replaced with this new one for the OCS Share API URL field, public shares, and public link reminder emails.
At the same time, all URLs unrelated to sharing remain unchanged and still use the standard UrlGenerator.
The web UI is also updated to use the OCS response's URL field, instead of reconstructing the share link from the current base URL. Again, if the flag is unset, we fall back to the existing local construction.
TYPE_EMAIL shares now expose a URL field in the OCS response. Also, ShareByMailProvider now takes PublicShareUrlGenerator, both email paths use it (sendEmail() and sendNote()).
This is my first contribution to this project, so I'd appreciate any feedback or guidance on how to approach the documentation and other details.
Assisted-by: Codex:GPT-5.6
Before:
After:
Updated Documentation PR
TODO
Manual live testing
Screenshots
Update documentation (
occ config:app:set core shareapi_public_link_base_url --value='https://example.com/')Checklist
3. to review, feature component)stable32)AI (if applicable)