MCPcopy Index your code
hub / github.com/rclone/rclone / decodeMetaDataRaw

Method decodeMetaDataRaw

backend/b2/b2.go:1752–1769  ·  view source on GitHub ↗

decodeMetaDataRaw sets the metadata from the data passed in Sets o.id o.modTime o.size o.sha1

(ID, SHA1 string, Size int64, UploadTimestamp api.Timestamp, Info map[string]string, mimeType string)

Source from the content-addressed store, hash-verified

1750// o.size
1751// o.sha1
1752func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp api.Timestamp, Info map[string]string, mimeType string) (err error) {
1753 o.id = ID
1754 o.sha1 = SHA1
1755 o.mimeType = mimeType
1756 // Read SHA1 from metadata if it exists and isn't set
1757 if o.sha1 == "" || o.sha1 == "none" {
1758 o.sha1 = Info[sha1Key]
1759 }
1760 o.sha1 = cleanSHA1(o.sha1)
1761 o.size = Size
1762 // Use the UploadTimestamp if can't get file info
1763 o.modTime = time.Time(UploadTimestamp)
1764 err = o.parseTimeString(Info[timeKey])
1765 if err != nil {
1766 return err
1767 }
1768 return nil
1769}
1770
1771// decodeMetaData sets the metadata in the object from an api.File
1772//

Callers 2

decodeMetaDataMethod · 0.95

Calls 2

parseTimeStringMethod · 0.95
cleanSHA1Function · 0.85

Tested by

no test coverage detected