Return an Object from a path If it can't be found it returns the error fs.ErrorObjectNotFound.
(ctx context.Context, remote string, info *objectstorage.ObjectSummary)
| 498 | // Return an Object from a path |
| 499 | // If it can't be found it returns the error fs.ErrorObjectNotFound. |
| 500 | func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *objectstorage.ObjectSummary) (fs.Object, error) { |
| 501 | o := &Object{ |
| 502 | fs: f, |
| 503 | remote: remote, |
| 504 | } |
| 505 | if info != nil { |
| 506 | // Set info but not meta |
| 507 | if info.TimeModified == nil { |
| 508 | fs.Logf(o, "Failed to read last modified") |
| 509 | o.lastModified = time.Now() |
| 510 | } else { |
| 511 | o.lastModified = info.TimeModified.Time |
| 512 | } |
| 513 | if info.Md5 != nil { |
| 514 | md5, err := o.base64ToMd5(*info.Md5) |
| 515 | if err != nil { |
| 516 | o.md5 = md5 |
| 517 | } |
| 518 | } |
| 519 | o.bytes = *info.Size |
| 520 | o.storageTier = storageTierMap[strings.ToLower(string(info.StorageTier))] |
| 521 | } else { |
| 522 | err := o.readMetaData(ctx) // reads info and headers, returning an error |
| 523 | if err != nil { |
| 524 | return nil, err |
| 525 | } |
| 526 | } |
| 527 | return o, nil |
| 528 | } |
| 529 | |
| 530 | // NewObject finds the Object at remote. If it can't be found |
| 531 | // it returns the error fs.ErrorObjectNotFound. |
no test coverage detected