Skip to content

fix(ui): redirect site-level go?to= links from ownCloud Web - #166

Open
mzner wants to merge 3 commits into
mainfrom
fix/site-level-go-redirect
Open

mzner wants to merge 3 commits into
mainfrom
fix/site-level-go-redirect

Conversation

@mzner

@mzner mzner commented Oct 28, 2026

Copy link
Copy Markdown

Description

ownCloud Web links its contextual help as https://doc.owncloud.com/go?to=<key> (e.g. the "Read more" link in the sharing help menus uses webui-users-sharing). This path has no .php and no server version segment, so go-redirect.js ignores it and users end up on the 404 page.

This extends go-redirect.js with a site-level SITE_MAPPING resolved against the site root for paths ending in /go:

  • webui-users-sharing → webui/owncloud_web/web_for_users.html#sharing
  • unknown/missing keys fall back to the site root index.html
  • existing go.php handling is unchanged (to= parsing moved into a shared parseKey())

Since the key is resolved on the docs side, already released oCIS versions are fixed as well, and future page moves only need an update here.

Related

Tests

  • extension-tests/go-redirect.test.js: site-level redirect with and without a path prefix, fallbacks, non-matching paths (/cargo, /go/), and a build check that every SITE_MAPPING target exists in public/

🤖 Generated with Claude Code

@mzner
mzner requested a review from a team as a code owner October 28, 2026 08:40
@CLAassistant

CLAassistant commented Oct 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

ownCloud Web links its contextual help as https://doc.owncloud.com/go?to=<key>, which falls through to the 404 page. Resolve these against a site-level key map, starting with webui-users-sharing.

Signed-off-by: Matteo <matteo.sonnenholzner@kiteworks.com>
@mzner
mzner force-pushed the fix/site-level-go-redirect branch from 7e2aa2b to 7ba6cb2 Compare October 28, 2026 13:17

@oc-tmueller oc-tmueller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good overall. I checked that #sharing resolves (idprefix: ''), that the webui path has no version segment, and that ocis#13254 only emits webui-users-sharing. The parseKey() extraction keeps the old behaviour.

One thing I'd fix before merging is the /go match (inline). The rest are minor.

Also stale and outside the diff: ui/supplemental/partials/head-scripts.hbs:8-9 still says the script "is a no-op unless the path ends in go.php".

Minor and fine to leave: /go/ and /Go aren't matched (the test deliberately locks /go/ → null). GitHub Pages doesn't add a trailing slash, so this only matters if a proxy or link shortener mangles the URL.

Comment thread ui/supplemental/js/go-redirect.js Outdated
Comment thread ui/supplemental/js/go-redirect.js Outdated
Comment thread ui/supplemental/js/go-redirect.js Outdated
Comment thread extension-tests/go-redirect.test.js Outdated
Only match /go directly under the site root (optionally behind one project-pages prefix), split the resolver into resolveSiteGo and resolveGoPhp behind resolve(), fall back to webui/index.html for unknown webui-* keys, check mapped anchors in the build test, and update stale comments.

Signed-off-by: Matteo <matteo.sonnenholzner@kiteworks.com>

@oc-tmueller oc-tmueller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — the approach looks good and the tests pass locally (18 pass, 3 skipped without public/). One correctness issue on production, plus a few smaller notes inline.

Comment thread ui/supplemental/js/go-redirect.js Outdated
Comment thread ui/supplemental/js/go-redirect.js
Comment thread extension-tests/go-redirect.test.js
Comment thread extension-tests/go-redirect.test.js Outdated
Comment thread extension-tests/go-redirect.test.js Outdated
Pass site.path to the script via data-site-root and match only <siteRoot>go (or go/) instead of guessing a single-segment prefix, so /webui/go and similar paths are left alone. Fix return-value docstrings, check that anchors are section headings, and share the build check between both maps.

Signed-off-by: Matteo <matteo.sonnenholzner@kiteworks.com>
@mzner
mzner requested a review from oc-tmueller October 29, 2026 09:49
@mzner

mzner commented Oct 29, 2026

Copy link
Copy Markdown
Author

@oc-tmueller I did the changes. Please take another look.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants