diff options
| author | Marin Ivanov <[email protected]> | 2026-01-16 22:56:23 +0200 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2026-01-16 22:56:23 +0200 |
| commit | d1c0046123f331fc18b6c2b15a357d0b18341c1b (patch) | |
| tree | b89d840686438c8c810b8af67c466e14b7b1b90f /main.go | |
| parent | 6cc36360929409e8d4113aa40c5fbe875478e469 (diff) | |
handle empty text
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -128,8 +128,11 @@ func (s *Server) postText(r *http.Request) (string, error) { var ext string text := r.Form.Get("text") - mimeType := r.Form.Get("text_mimetype") + if text == "" { + return "", nil + } + mimeType := r.Form.Get("text_mimetype") rd := io.Reader(strings.NewReader(text)) if mimeType == "text/plain" { ext = ".txt" |
