feat(files): add folder download as zip

- Add zip folder API endpoint
- Add download button to folder rows
- Enforce max archive size limit
- Document endpoint in OpenAPI
This commit is contained in:
2026-09-01 20:20:15 +03:00
parent 1bba2c6b51
commit e7982c5487
7 changed files with 288 additions and 9 deletions
+17
View File
@@ -97,6 +97,23 @@ func Spec() map[string]any {
}),
},
},
"/api/v1/files/zip": map[string]any{
"get": map[string]any{
"summary": "Download a directory as a zip archive",
"operationId": "zipFolder",
"description": "Zips the directory into a temporary file and streams it as an attachment.",
"parameters": []map[string]any{
{"name": "path", "in": "query", "required": true, "schema": map[string]string{"type": "string"}, "description": "Absolute path to the directory"},
},
"responses": auth(map[string]any{
"200": map[string]any{"description": "Zip archive", "content": map[string]any{"application/zip": map[string]any{"schema": map[string]string{"type": "string", "format": "binary"}}}},
"400": errResp("Invalid path or not a directory"),
"403": errResp("Path outside allowed root"),
"404": errResp("Path not found"),
"413": errResp("Archive exceeds size limit"),
}),
},
},
"/api/v1/download": map[string]any{
"get": map[string]any{
"summary": "Download a file",