diff --git a/handlers.go b/handlers.go index 4992098..7dda853 100644 --- a/handlers.go +++ b/handlers.go @@ -81,11 +81,6 @@ func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template) http.Handl } } - idLength := 16 - if r.URL.Query().Get("idlength") == "short" { - idLength = 10 - } - returnType := strings.TrimSpace(r.URL.Query().Get("return")) if returnType == "" { returnType = "json" @@ -175,6 +170,14 @@ func uploadHandler(db *gorm.DB, cfg Config, pages *template.Template) http.Handl return } + idLength := 16 + if r.URL.Query().Get("idlength") == "short" { + idLength = 10 + } + if r.PostForm.Get("idlength") == "short" { + idLength = 10 + } + id := generateId(idLength) path := getStoragePath(cfg.UploadDir, id) if err := os.MkdirAll(filepath.Dir(path), 0700); err != nil { diff --git a/static/css/main.css b/static/css/main.css index e0314c5..f290b5b 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -142,8 +142,7 @@ input[type="file"]::file-selector-button { font: inherit; } -label[for="file-expiry"], -label[for="paste-expiry"] { +.muted { color: var(--text-muted); } select { diff --git a/templates/home.html b/templates/home.html index 93d5e67..024b138 100644 --- a/templates/home.html +++ b/templates/home.html @@ -26,24 +26,34 @@
- + + +
- + + +