Skip to content

fix(v0.24): link uploads with PATCH, and stop hiding link failures - #13

Merged
whtis merged 1 commit into
mainfrom
fix/v024-attachment-link
Jul 19, 2026
Merged

fix(v0.24): link uploads with PATCH, and stop hiding link failures#13
whtis merged 1 commit into
mainfrom
fix/v024-attachment-link

Conversation

@whtis

@whtis whtis commented Jul 19, 2026

Copy link
Copy Markdown
Owner

The bug

Posting a memo with an image against a Memos v0.24 server left the image
invisible everywhere — in the app, on the web client, and in the memo itself.
Server-side the file showed up as an unused resource.

Root cause: linking an upload to a memo went out as POST, but v0.24's proto
binds SetMemoResources to patch: "/api/v1/{name=memos/*}/resources".

Probed against real servers:

server POST PATCH
memos 0.24.0 501 Method Not Allowed 200
memos 0.24.3 501 Method Not Allowed 200

The upload itself always succeeded, so the file landed on the server attached to
nothing. v0.25+ was never affected — it uses the attachments endpoint, which
the app already PATCHes.

Why it stayed hidden

Images used to be embedded in the markdown content as well, which rendered them
even when the link call failed. c463cd2 removed that embed to fix the
double-render on web (#5) — correctly — and in doing so took the cover off this
bug, on v0.24 only.

Changes

  1. MemoApi.setMemoResources: @POST@PATCH.
  2. Stop swallowing link failures. The catch logged and moved on, so a save
    that lost its attachments looked identical to one that worked — that silence is
    what let this ship. It now surfaces an error and keeps the editor open. The memo
    is already created by that point, so memoId is captured from the create:
    retrying updates that memo instead of posting a duplicate.
  3. Regression test at the Retrofit level pinning method + path + body for both
    endpoints. Negative-tested: reverting to POST turns it red.

Verification

End-to-end from the app on an emulator against real servers — posted a memo with
an image, then checked the server:

server attachment linked unused resources left
memos 0.24.3 yes 0
memos 0.25.3 yes 0

Local testDebugUnitTest + lintDebug green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RZ9mXqLfk6PKwo8V9pVDEC

Attaching an upload to a memo on a v0.24 server used POST, but the proto binds
SetMemoResources to `patch: "/api/v1/{name=memos/*}/resources"`. Real v0.24.0 and
v0.24.3 both answer 501 Method Not Allowed to the POST. The upload itself had
already succeeded, so the file sat on the server as an unused resource, attached
to nothing and visible on no client — the memo posted fine, just without its
images. v0.25+ was never affected; it uses the attachments endpoint, which the
app already patches.

This was invisible for as long as it was because images used to be embedded in
the markdown content as well, which rendered them even when the link call failed.
Removing that embed in c463cd2 (issue #5) took the cover away and left the plain
bug — on v0.24 only.

The link failure was also caught and logged and nothing else, so a save that lost
its attachments looked exactly like one that worked. It now surfaces the error and
keeps the editor open. The memo itself is already created at that point, so
memoId is captured from the create: retrying updates that memo rather than posting
a duplicate.

Verified end-to-end from the app against memos 0.24.3 and 0.25.3: memo posted with
an image, attachment linked server-side, no unused resources left behind. The
Retrofit-level test pins both verbs — it fails on the old POST.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZ9mXqLfk6PKwo8V9pVDEC
@whtis
whtis force-pushed the fix/v024-attachment-link branch from efe0c45 to 5daac7a Compare July 19, 2026 11:37
@whtis
whtis merged commit 075bdca into main Jul 19, 2026
5 checks passed
whtis added a commit that referenced this pull request Jul 19, 2026
Ships the v0.24 attachment-linking fix from #13.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZ9mXqLfk6PKwo8V9pVDEC
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.

1 participant