Fix double slash in Micropub URL construction
Some checks failed
Build Container / build (push) Failing after 12s

- Remove leading slash when constructing URLs with SITE_URL
- SITE_URL already includes trailing slash per IndieAuth spec
- Fixes malformed Location header in Micropub responses
- Fixes malformed URLs in Microformats2 query responses

Changes:
- starpunk/micropub.py line 312: f"{site_url}notes/{note.slug}"
- starpunk/micropub.py line 383: f"{site_url}notes/{note.slug}"
- Added comments explaining SITE_URL trailing slash convention
- Updated version to 1.0.1 in starpunk/__init__.py
- Updated CHANGELOG.md with v1.0.1 release notes

Fixes double slash issue reported after v1.0.0 release.

Per ADR-039 and docs/releases/v1.0.1-hotfix-plan.md

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-25 08:56:06 -07:00
parent 50ce3c526d
commit 8adb27c6ed
4 changed files with 238 additions and 4 deletions

View File

@@ -153,5 +153,5 @@ def create_app(config=None):
# Package version (Semantic Versioning 2.0.0)
# See docs/standards/versioning-strategy.md for details
__version__ = "1.0.0"
__version_info__ = (1, 0, 0)
__version__ = "1.0.1"
__version_info__ = (1, 0, 1)

View File

@@ -307,8 +307,9 @@ def handle_create(data: dict, token_info: dict):
)
# Build permalink URL
# Note: SITE_URL is normalized to include trailing slash (for IndieAuth spec compliance)
site_url = current_app.config.get("SITE_URL", "http://localhost:5000")
permalink = f"{site_url}/notes/{note.slug}"
permalink = f"{site_url}notes/{note.slug}"
# Return 201 Created with Location header
return "", 201, {"Location": permalink}
@@ -372,13 +373,14 @@ def handle_query(args: dict, token_info: dict):
return error_response("server_error", "Failed to retrieve post")
# Convert note to Micropub Microformats2 format
# Note: SITE_URL is normalized to include trailing slash (for IndieAuth spec compliance)
site_url = current_app.config.get("SITE_URL", "http://localhost:5000")
mf2 = {
"type": ["h-entry"],
"properties": {
"content": [note.content],
"published": [note.created_at.isoformat()],
"url": [f"{site_url}/notes/{note.slug}"],
"url": [f"{site_url}notes/{note.slug}"],
},
}