Skip to content

Resolve relative web app icon hrefs against the page URL - #14217

Open
sircraig wants to merge 1 commit into
omacom:quattrofrom
sircraig:fix/webapp-relative-icon-href
Open

sircraig wants to merge 1 commit into
omacom:quattrofrom
sircraig:fix/webapp-relative-icon-href

Conversation

@sircraig

@sircraig sircraig commented Oct 4, 2026 •

Copy link
Copy Markdown

Fixes #14219

Problem

omarchy webapp install can't fetch the icon for apps served under a subpath, so the install fails with Error: Failed to download icon. (or prompts for an icon URL interactively).

For example, a self-hosted app where https://host/ redirects to https://host/app/, and the page declares

<link rel="apple-touch-icon" href="icon.png">

fetch_site_icon resolved that relative href against the origin (https://host/icon.png → 404) rather than the page's directory (https://host/app/icon.png), then fell through to /apple-touch-icon.png (404) and Google's favicon service (404 for a private host).

Fix

  • Resolve relative hrefs against the page's directory, as a browser does.
  • Use the URL after redirects (curl -w '%{url_effective}' on the same request that fetches the page), so https://host/ → /app/ resolves correctly too.
  • Strip the fragment and query before taking the directory (https://host/app/#/home).

Absolute, protocol-relative and root-relative (/...) hrefs are handled as before. The /apple-touch-icon.png fallback now uses the post-redirect origin.

Testing

  • Added a regression case to test/shell.d/webapp-install-test.sh with a stubbed curl serving a redirected /app/ page with a relative icon href. It fails on quattro and passes with this change.
  • webapp-install-test.sh, webapp-install-escaping-test.sh, webapp-name-test.sh and preinstalls-test.sh pass.
  • Checked manually against a live self-hosted app served under a subpath, and against sites that already worked (github.com, hey.com).

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Changes how web app icons are resolved from HTML.

The PR appears safe to merge; no outstanding findings remain.

Summary

The PR resolves relative web app icon URLs against the page URL after redirects and adds a regression test for an app served under a subpath. There are no changes since the previous review, and all previous Greptile threads are resolved.

Reviews (4) · Last reviewed commit: "Resolve relative web app icon hrefs agai..."

Comment thread bin/omarchy-webapp-install Resolved
Comment thread test/shell.d/webapp-install-test.sh Resolved
Comment thread bin/omarchy-webapp-install Resolved
@sircraig
sircraig force-pushed the fix/webapp-relative-icon-href branch from 997c439 to 32ff728 Compare October 4, 2026 09:00

@chessing234 chessing234 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.

Reviewed head 32ff728f425556a6a279186e4ff242f440e006cc.

Reviewed redirected page URL capture, origin/directory construction, and relative icon resolution. The isolated webapp-install test passed, including the redirect-to-subdirectory fixture. No actionable defect found in that covered path. I did not perform a real network/webapp install.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. I read the change and classified it as a bug fix: relative apple-touch-icon hrefs resolving against the origin rather than the page's directory after redirects. That classification isn't settled yet, because the second opinion (Codex Medium) didn't run: omabot's daily review allowance was already used up when this came round. Without an agreed classification I haven't labelled it or tested it on a worker yet.

Nothing is needed from you. The pull request will come round again when reviews are available, and the next comment will cover the reproduction on a worker and the review.

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.

Web app install can't fetch a relative icon for apps served under a subpath

3 participants