mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-23 04:30:19 +01:00
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`
This commit is contained in:
parent
7bf499b092
commit
05df7fc453
1 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue