Fix relative Location header when Micropub creates an article #134

Merged
jonny merged 2 commits from fix/micropub-article-location-url into develop 2026-09-13 13:20:14 +02:00
Owner

Summary

  • After posting a draft article via iA Writer's manual-token Micropub setup, iA Writer showed macOS's generic "This application can't be opened" dialog even though the post succeeded server-side.
  • Root cause: EntryHandler used Article::link, which is deliberately a site-relative path (/blog/2026/09/slug) everywhere else it's used (redirects, blade href, feeds prepend the site URL themselves). It was fed straight into the Micropub response's Location header, unlike every other post type (Note, Bookmark, Place), which already return absolute URLs there. iA Writer appears to treat a relative Location as a local file path and fails to open it.
  • Confirmed the draft's canonical URL resolves fine either way — ArticlesController::show() doesn't filter by published, so drafts are unlisted (excluded from /blog and feeds) but still publicly viewable at their link. So the existing URL just needed to be absolute, not different.
  • Fix: added Article::uri, following the same uri/link convention already used by Note, Bookmark, and Place (uri = absolute, link = relative), and pointed EntryHandler at it instead of ->link.

Test plan

  • ./vendor/bin/sail test — full suite passes (378 tests), including a new Article::uri unit test and a regression test asserting the Micropub Location header is absolute for article creation
  • ./vendor/bin/sail pint --test — clean

🤖 Generated with Claude Code

https://claude.ai/code/session_017USyUg8PwuoDcHP8pv5xjy

## Summary - After posting a draft article via iA Writer's manual-token Micropub setup, iA Writer showed macOS's generic "This application can't be opened" dialog even though the post succeeded server-side. - Root cause: `EntryHandler` used `Article::link`, which is deliberately a site-relative path (`/blog/2026/09/slug`) everywhere else it's used (redirects, blade `href`, feeds prepend the site URL themselves). It was fed straight into the Micropub response's `Location` header, unlike every other post type (`Note`, `Bookmark`, `Place`), which already return absolute URLs there. iA Writer appears to treat a relative Location as a local file path and fails to open it. - Confirmed the draft's canonical URL resolves fine either way — `ArticlesController::show()` doesn't filter by `published`, so drafts are unlisted (excluded from `/blog` and feeds) but still publicly viewable at their link. So the existing URL just needed to be absolute, not different. - Fix: added `Article::uri`, following the same `uri`/`link` convention already used by `Note`, `Bookmark`, and `Place` (`uri` = absolute, `link` = relative), and pointed `EntryHandler` at it instead of `->link`. ## Test plan - [x] `./vendor/bin/sail test` — full suite passes (378 tests), including a new `Article::uri` unit test and a regression test asserting the Micropub `Location` header is absolute for article creation - [x] `./vendor/bin/sail pint --test` — clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017USyUg8PwuoDcHP8pv5xjy
EntryHandler used Article::link, which is deliberately a site-relative
path elsewhere in the app, directly as the Micropub response's
Location URL. Every other post type it returns (notes, bookmarks,
places) already prepends the site URL, so articles were the only case
where clients received a relative Location - iA Writer appears to
treat that as a local file path and fails to open it after posting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017USyUg8PwuoDcHP8pv5xjy
Follow the uri/link convention already used by Note, Bookmark, and
Place, rather than concatenating config('app.url') inline where the
absolute URL is needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017USyUg8PwuoDcHP8pv5xjy
jonny merged commit 4aa93d63bb into develop 2026-09-13 13:20:14 +02:00
jonny deleted branch fix/micropub-article-location-url 2026-09-13 13:20:14 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jonny/jonnybarnes.uk!134
No description provided.