feat(gateway): 图片上传端点(B1) — POST /v1/upload + GET /v1/files/{name}
- upload.go: multipart上传(owner/admin+审计)→ {url,size,mime,name}; MaxBytesReader 5MB + DetectContentType嗅探 + 白名单raster(拒SVG/HTML) + crypto/rand 128-bit随机名 + 0700目录
- 静态服务: 同端口 GET /v1/files/{name}, 能力URL, 路径穿越全形态拒绝(.. / %2f / %2e%2e), nosniff, Range
- errors: ErrPayloadTooLarge(413)/ErrUnsupportedMediaType(415)
- server.go 路由+Deps.DataDir; wire.go resolveDataDir 注入
- 8测试+真实二进制E2E, build/vet/test绿+交叉编译
- Docs/api-client v0.24 + api-reference §0.3 同步
This commit is contained in:
1 parent
3fc10fb86f
commit
7ecb43bd5d
7 files changed
+723
-3
No files matched your search
@@ -96,6 +96,13 @@ var (
|
||||
// ErrBadRequest means the request is malformed (400).
|
||||
ErrBadRequest = newWithHTTP("bad_request", "bad request", http.StatusBadRequest)
|
||||
|
||||
// ErrPayloadTooLarge means the request body exceeds the allowed size (413).
|
||||
ErrPayloadTooLarge = newWithHTTP("payload_too_large", "payload too large", http.StatusRequestEntityTooLarge)
|
||||
|
||||
// ErrUnsupportedMediaType means the request carries a media type the endpoint
|
||||
// does not accept (415).
|
||||
ErrUnsupportedMediaType = newWithHTTP("unsupported_media_type", "unsupported media type", http.StatusUnsupportedMediaType)
|
||||
|
||||
// ErrRateLimited means the caller exceeded a rate limit (429).
|
||||
ErrRateLimited = newWithHTTP("rate_limited", "rate limited", http.StatusTooManyRequests)
|
||||
|
||||
|
||||
Reference in new issue
Block a user