Add POST /files to store an uploaded file inside a home folder
The handler reuses the home-path resolution of GET /files, refuses special filesystems and non-directories, writes with O_EXCL so an existing name is answered 409 instead of overwritten, enforces the chat upload size limit and replies with the stored name, path and size.
This commit is contained in:
@@ -155,6 +155,7 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
|
||||
})
|
||||
mux.HandleFunc("GET /discovery", serveServerDiscovery)
|
||||
mux.HandleFunc("GET /files", serveHomeFile)
|
||||
mux.HandleFunc("POST /files", serveHomeFileUpload)
|
||||
mux.HandleFunc("POST /chat-uploads", serveChatUpload)
|
||||
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
Reference in New Issue
Block a user