file chooser dialog diabled by default.

This commit is contained in:
Miroslav Šedivý
2023-11-24 10:39:09 +01:00
parent d9bcde3331
commit b40c0778c8
7 changed files with 37 additions and 10 deletions

View File

@ -87,6 +87,10 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) error {
}
func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) error {
if !h.desktop.IsFileChooserDialogEnabled() {
return utils.HttpBadRequest("file chooser dialog is disabled")
}
err := r.ParseMultipartForm(maxUploadSize)
if err != nil {
return utils.HttpBadRequest("failed to parse multipart form").WithInternalErr(err)
@ -150,6 +154,10 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) e
}
func (h *RoomHandler) uploadDialogClose(w http.ResponseWriter, r *http.Request) error {
if !h.desktop.IsFileChooserDialogEnabled() {
return utils.HttpBadRequest("file chooser dialog is disabled")
}
if !h.desktop.IsFileChooserDialogOpened() {
return utils.HttpUnprocessableEntity("file chooser dialog is not open")
}