Merge pull request #1 from boba-best/add-default-expiry
Use default expiry in API
This commit is contained in:
commit
702b0fb193
|
@ -405,11 +405,11 @@ func barePlusExt(filename string) (barename, extension string) {
|
||||||
|
|
||||||
func parseExpiry(expStr string) time.Duration {
|
func parseExpiry(expStr string) time.Duration {
|
||||||
if expStr == "" {
|
if expStr == "" {
|
||||||
return time.Duration(Config.maxExpiry) * time.Second
|
return time.Duration(Config.defaultExpiry) * time.Second
|
||||||
} else {
|
} else {
|
||||||
fileExpiry, err := strconv.ParseUint(expStr, 10, 64)
|
fileExpiry, err := strconv.ParseUint(expStr, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return time.Duration(Config.maxExpiry) * time.Second
|
return time.Duration(Config.defaultExpiry) * time.Second
|
||||||
} else {
|
} else {
|
||||||
if Config.maxExpiry > 0 && (fileExpiry > Config.maxExpiry || fileExpiry == 0) {
|
if Config.maxExpiry > 0 && (fileExpiry > Config.maxExpiry || fileExpiry == 0) {
|
||||||
fileExpiry = Config.maxExpiry
|
fileExpiry = Config.maxExpiry
|
||||||
|
|
Loading…
Reference in New Issue