summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2026-01-16 22:56:23 +0200
committerMarin Ivanov <[email protected]>2026-01-16 22:56:23 +0200
commitd1c0046123f331fc18b6c2b15a357d0b18341c1b (patch)
treeb89d840686438c8c810b8af67c466e14b7b1b90f /main.go
parent6cc36360929409e8d4113aa40c5fbe875478e469 (diff)
handle empty text
Diffstat (limited to 'main.go')
-rw-r--r--main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.go b/main.go
index c590328..19e557e 100644
--- a/main.go
+++ b/main.go
@@ -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"