Files
seaweedfs/weed/util/constants
Chris LuandClaude Opus 5.5 a8f13e7db2 filer: keep a PUT under /etc inline like a POST (#13241)
* filer: keep a PUT under /etc inline like a POST

The write handler marks /etc paths (and saveInside=true) to be stored as
inline content, but only the multipart POST path honoured it. A plain PUT
went through the chunk uploader, which keeps content inline only below
saveToFilerLimit, 0 by default, so `curl -T x.json http://filer/etc/...`
stored chunks and the loaders that read /etc files from inline content saw
nothing.

Both paths now share one saveInside write: read the body, check
Content-Md5, store it as the entry's content. An append to a chunked file
is refused for PUT as it already was for POST, and an offset write is
refused for both instead of being treated as a whole-file write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: skip the saveInside PUT digest checks under fips140=only

GODEBUG=fips140=only refuses MD5: the filer neither checks Content-Md5
nor reports Content-MD5, and crypto/md5 panics. The bad-digest test is
skipped there, and the inline-store test checks the digest only when MD5
is available while always checking the content is inline with no chunks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: answer a malformed write offset with 400

A negative, non-numeric or overflowing ?offset, and an offset with
op=append, were plain errors that the write handler answered with 500,
while a positive offset to inline content got 400. Both the inline and the
chunk path now parse it through one helper whose error carries the
ErrMsgInvalidOffset prefix, mapped to 400. offset=0 stays a whole write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: charge a saveInside PUT its whole body like a POST

A PUT stored inside the entry is now buffered whole by saveInsideEntry,
but uploadCharge still charged it by chunks, so -concurrentUploadLimitMB
no longer bounded the memory it holds. It is charged as the POST is: its
declared length, at most the whole budget, or the whole budget when the
length is unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: bound a body stored inside the entry at 16 MiB

A saveInside or /etc upload is read into memory whole, and nothing capped
it: one PUT or POST could grow the filer's memory without bound, as the
upload charge limits concurrency rather than bytes. The read now stops at
16 MiB, far above any config file, and a larger body is answered 413 with
nothing stored, whether or not its length was declared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: keep inline storage to entries inside /etc/

The /etc check was a bare string prefix, so a PUT to /etcd-backup/snap.db
or /etcetera took the saveInside path and a large body was refused with
413 instead of chunked. Match /etc/ as a directory for the write, upload
charge and zip extract paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: bound a zip member kept inline like a saveInside upload

A zip member extracted under /etc/ (or with saveInside=true) is read into
memory whole, but was bounded only by the 1 TiB archive limit. Refuse a
member over saveInsideMaxBytes, as a PUT or POST body is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* filer: keep a multipart POST to the bare /etc directory inline

A POST to /etc with a file name lands the file inside the /etc directory,
but the /etc/ prefix check missed the bare path and stored it as chunks.
Match /etc itself as well as entries under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:46:59 -08:00
..