mirror of
https://github.com/rclone/rclone
synced 2024-11-23 00:06:55 +01:00
acd: Fix nil pointer deref - fixes #916
This commit is contained in:
parent
7929b6e756
commit
05798672c8
@ -819,7 +819,7 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
||||
if t != fs.HashMD5 {
|
||||
return "", fs.ErrHashUnsupported
|
||||
}
|
||||
if o.info.ContentProperties.Md5 != nil {
|
||||
if o.info.ContentProperties != nil && o.info.ContentProperties.Md5 != nil {
|
||||
return *o.info.ContentProperties.Md5, nil
|
||||
}
|
||||
return "", nil
|
||||
@ -827,8 +827,11 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
||||
|
||||
// Size returns the size of an object in bytes
|
||||
func (o *Object) Size() int64 {
|
||||
if o.info.ContentProperties != nil && o.info.ContentProperties.Size != nil {
|
||||
return int64(*o.info.ContentProperties.Size)
|
||||
}
|
||||
return 0 // Object is likely PENDING
|
||||
}
|
||||
|
||||
// readMetaData gets the metadata if it hasn't already been fetched
|
||||
//
|
||||
@ -1108,7 +1111,7 @@ OnConflict:
|
||||
|
||||
// MimeType of an Object if known, "" otherwise
|
||||
func (o *Object) MimeType() string {
|
||||
if o.info.ContentProperties.ContentType != nil {
|
||||
if o.info.ContentProperties != nil && o.info.ContentProperties.ContentType != nil {
|
||||
return *o.info.ContentProperties.ContentType
|
||||
}
|
||||
return ""
|
||||
|
Loading…
Reference in New Issue
Block a user