MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / DecodeAttachment

Function DecodeAttachment

db/attachment.go:431–440  ·  view source on GitHub ↗
(att interface{})

Source from the content-addressed store, hash-verified

429}
430
431func DecodeAttachment(att interface{}) ([]byte, error) {
432 switch att := att.(type) {
433 case []byte:
434 return att, nil
435 case string:
436 return base64.StdEncoding.DecodeString(att)
437 default:
438 return nil, base.HTTPErrorf(400, "invalid attachment data (type %T)", att)
439 }
440}
441
442func Sha1DigestKey(data []byte) string {
443 digester := sha1.New()

Callers 3

WriteMultipartDocumentFunction · 0.92
storeAttachmentsMethod · 0.85

Calls 1

HTTPErrorfFunction · 0.92

Tested by 1