Use AddressObject.Stat if supported

This commit is contained in:
emersion 2017-09-09 16:37:49 +02:00
parent 7d69432517
commit 8d4a1ede86
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -284,11 +284,16 @@ func (fs *fileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error
} }
id := fs.addressObjectID(name) id := fs.addressObjectID(name)
_, err := fs.ab.GetAddressObject(id) ao, err := fs.ab.GetAddressObject(id)
if err != nil { if err != nil {
return nil, err return nil, err
} }
info, err := ao.Stat()
if info != nil || err != nil {
return info, err
}
return &fileInfo{ return &fileInfo{
name: name, name: name,
mode: os.ModePerm, mode: os.ModePerm,