mirror of
https://github.com/drakkan/sftpgo.git
synced 2026-03-14 14:25:52 +01:00
Merge 281b9d768f into 03ae0a1c84
This commit is contained in:
commit
4fa7b48712
1 changed files with 23 additions and 1 deletions
|
|
@ -86,6 +86,28 @@ func init() {
|
|||
version.AddFeature("+s3")
|
||||
}
|
||||
|
||||
func getLocalTimeFromPointer(t *time.Time) time.Time {
|
||||
if t == nil {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
originalTime := *t
|
||||
|
||||
// 1. UTC.
|
||||
utcTime := originalTime.In(time.UTC)
|
||||
|
||||
// 2. Local.
|
||||
loc, err := time.LoadLocation("Local")
|
||||
if err != nil {
|
||||
return utcTime
|
||||
}
|
||||
|
||||
// 3. Convert
|
||||
localTime := utcTime.In(loc)
|
||||
|
||||
return localTime
|
||||
}
|
||||
|
||||
// NewS3Fs returns an S3Fs object that allows to interact with an s3 compatible
|
||||
// object storage
|
||||
func NewS3Fs(connectionID, localTempDir, mountPath string, s3Config S3FsConfig) (Fs, error) {
|
||||
|
|
@ -1364,7 +1386,7 @@ func (l *s3DirLister) Next(limit int) ([]os.FileInfo, error) {
|
|||
l.prefixes[name] = true
|
||||
}
|
||||
for _, fileObject := range page.Contents {
|
||||
objectModTime := util.GetTimeFromPointer(fileObject.LastModified)
|
||||
objectModTime := getLocalTimeFromPointer(fileObject.LastModified)
|
||||
objectSize := util.GetIntFromPointer(fileObject.Size)
|
||||
name, isDir := l.resolve(fileObject.Key)
|
||||
if name == "" || name == "/" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue