Skip to content

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Dec 4, 2025

  • Resolves: #

Summary

Prevent double-slash artifacts caused when non-CLI returned '/' for root. And make the underlying implementation consistent.

  • Ensure non‑CLI branch returns the canonical webroot ('' for root installs, '/subpath' for subdirectory installs)
  • Extract CLI parsing into helper
  • Centralize normalization to avoid duplicated/conflicting logic

For ease of review (since I also did a refactor to streamline things), the problematic lines were 534 & 536 in master. CLI mode always made sure to drop the trailing slash and thus handled a root installation fine by returning '' (correct behavior):

$webRoot = rtrim((parse_url($webRoot, PHP_URL_PATH) ?? ''), '/');

But the non-CLI mode code path would return '/' (inconsistent with CLI mode and also incorrect) for the same root installation:

$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';

Often not a serious problem, but was technically incorrect nonetheless.

TODO

  • ...

Checklist

Prevent double-slash artifacts caused when non-CLI returned '/' for root.

- Ensure non‑CLI branch returns the canonical webroot ('' for root installs, '/subpath' for subdirectory installs)
- Extract CLI parsing into helper
- Centralize normalization to avoid duplicated/conflicting logic

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards requested a review from a team as a code owner December 4, 2025 16:37
@joshtrichards joshtrichards requested review from icewind1991, leftybournes, salmart-dev and yemkareems and removed request for a team December 4, 2025 16:37
@joshtrichards joshtrichards added this to the Nextcloud 33 milestone Dec 4, 2025
@joshtrichards joshtrichards added bug feature: install and update ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) 3. to review Waiting for reviews labels Dec 4, 2025
This was referenced Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: install and update ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants