mirror of
https://github.com/usememos/memos.git
synced 2026-11-19 10:29:11 +01:00
3feb08737b
WriteError now logs the cause of a server error, which the public JSON body never carries, unless the client has already gone away. The header reset and envelope move into a shared writer the panic recoverer uses too, so one failure logs once. The doc comment states the header contract. A local attachment whose file is gone from disk answers a JSON 404 like every other storage failure instead of net/http's plain-text page. The export handler no longer strips the archive headers itself and logs only the committed case the wrapper cannot see. The fake S3 and local storage test setups are shared helpers, and the 416 test pins that Content-Range survives the header reset.
internal
Private plumbing with no memos vocabulary. A package belongs here only if it
could be published tomorrow as a standalone module without changes: it imports
nothing from store, core, server, provider, markdown, filter, or
proto/gen. The depguard rules in .golangci.yaml enforce that.
| Package | Purpose |
|---|---|
clientip/ |
trusted-proxy aware client IP resolution middleware |
email/ |
SMTP client, config, and message types |
httphandler/ |
HTTP response errors, panic recovery, and routing compatibility |
identifier/ |
grammar of UIDs and usernames shared by parser, store, and API |
linkmeta/ |
HTML metadata, oEmbed, and image fetching for link previews |
motionphoto/ |
Live Photo and Motion Photo container parsing |
profile/ |
process configuration parsed from flags and environment |
random/ |
UUIDs and random strings from a secure source |
ratelimit/ |
sliding-window rate limiter |
testutil/ |
test fixtures and the fake S3 server (the one package allowed to import proto/gen) |
version/ |
CalVer build metadata from release overrides or the embedded Git commit |
webhook/ |
signed webhook delivery with SSRF protection |
Do not add util, common, base, or helpers packages. Name a package for
the one thing it does, or put the code next to its only caller.