Procházet zdrojové kódy

Add Max-Hours and Max-Seconds

Better will be to avoid copy-paste here and to use not headers for params, but url's params, like:
`curl --upload-file ./hello.txt https://transfer.sh/hello.txt?max-downloads=5`
pull/84/head
Alexander Ustimenko před 7 roky
committed by GitHub
rodič
revize
05df7fc453
1 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. +12
    -0
      server/handlers.go

+ 12
- 0
server/handlers.go Zobrazit soubor

@@ -319,6 +319,18 @@ func MetadataForRequest(contentType string, r *http.Request) Metadata {
metadata.MaxDate = time.Now().Add(time.Hour * 24 * time.Duration(v))
}

if v := r.Header.Get("Max-Hours"); v == "" {
} else if v, err := strconv.Atoi(v); err != nil {
} else {
metadata.MaxDate = time.Now().Add(time.Hour * time.Duration(v))
}

if v := r.Header.Get("Max-Seconds"); v == "" {
} else if v, err := strconv.Atoi(v); err != nil {
} else {
metadata.MaxDate = time.Now().Add(time.Second * time.Duration(v))
}

return metadata
}



Načítá se…
Zrušit
Uložit