mirror of https://github.com/Xhofe/alist
fix(189pc): wrong time if location incorrect (close #1562)
parent
918ca28d2b
commit
fbaebc020f
|
@ -78,7 +78,8 @@ func timestamp() int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func MustParseTime(str string) *time.Time {
|
func MustParseTime(str string) *time.Time {
|
||||||
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05", str, time.Local)
|
loc, _ := time.LoadLocation("Asia/Shanghai")
|
||||||
|
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05", str, loc)
|
||||||
return &lastOpTime
|
return &lastOpTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ func CreateNestedFile(path string) (*os.File, error) {
|
||||||
|
|
||||||
// CreateTempFile create temp file from io.ReadCloser, and seek to 0
|
// CreateTempFile create temp file from io.ReadCloser, and seek to 0
|
||||||
func CreateTempFile(r io.ReadCloser) (*os.File, error) {
|
func CreateTempFile(r io.ReadCloser) (*os.File, error) {
|
||||||
f, err := ioutil.TempFile(conf.Conf.TempDir, "file-*")
|
f, err := os.CreateTemp(conf.Conf.TempDir, "file-*")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue