Beispiel #1
0
func (p dataProvider) Put(c schema.Content) (schema.Content, error) {
	if c.Type == "" {
		c.Type = DetectContentType(c.Data)
	}
	out := schema.Content{
		Url:  "data:" + c.Type,
		Type: c.Type,
	}
	if strings.HasPrefix(c.Type, "text/") {
		out.Url += "," + url.QueryEscape(string(c.Data))
	} else {
		out.Url += ";base64." + url.QueryEscape(base64.StdEncoding.EncodeToString(c.Data))
	}
	return out, nil
}