Mirro fix on PR #311

This commit is contained in:
Unknwon 2014-08-01 00:24:29 -04:00
parent 568c9b353e
commit b95e78f7e6

View File

@ -187,54 +187,23 @@ func NewConfigContext() {
AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10) AttachmentMaxFiles = Cfg.MustInt("attachment", "MAX_FILES", 10)
AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true) AttachmentEnabled = Cfg.MustBool("attachment", "ENABLE", true)
TimeFormat = Cfg.MustValue("time", "FORMAT", time.RFC1123) TimeFormat = map[string]string{
"ANSIC": time.ANSIC,
switch TimeFormat { "UnixDate": time.UnixDate,
case "ANSIC": "RubyDate": time.RubyDate,
TimeFormat = time.ANSIC "RFC822": time.RFC822,
"RFC822Z": time.RFC822Z,
case "UnixDate": "RFC850": time.RFC850,
TimeFormat = time.UnixDate "RFC1123": time.RFC1123,
"RFC1123Z": time.RFC1123Z,
case "RubyDate": "RFC3339": time.RFC3339,
TimeFormat = time.RubyDate "RFC3339Nano": time.RFC3339Nano,
"Kitchen": time.Kitchen,
case "RFC822": "Stamp": time.Stamp,
TimeFormat = time.RFC822 "StampMilli": time.StampMilli,
"StampMicro": time.StampMicro,
case "RFC822Z": "StampNano": time.StampNano,
TimeFormat = time.RFC822Z }[Cfg.MustValue("time", "FORMAT", "RFC1123")]
case "RFC850":
TimeFormat = time.RFC850
case "RFC1123":
TimeFormat = time.RFC1123
case "RFC1123Z":
TimeFormat = time.RFC1123Z
case "RFC3339":
TimeFormat = time.RFC3339
case "RFC3339Nano":
TimeFormat = time.RFC3339Nano
case "Kitchen":
TimeFormat = time.Kitchen
case "Stamp":
TimeFormat = time.Stamp
case "StampMilli":
TimeFormat = time.StampMilli
case "StampMicro":
TimeFormat = time.StampMicro
case "StampNano":
TimeFormat = time.StampNano
}
if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil { if err = os.MkdirAll(AttachmentPath, os.ModePerm); err != nil {
log.Fatal(4, "Could not create directory %s: %s", AttachmentPath, err) log.Fatal(4, "Could not create directory %s: %s", AttachmentPath, err)