MCPcopy Create free account
hub / github.com/cli/cli / newVideoAsset

Function newVideoAsset

internal/attachments/userasset.go:104–116  ·  view source on GitHub ↗

newVideoAsset applies what only holds for a video: a player has no alt attribute to fill, so the author cannot supply one, and the name that stands in keeps its extension because it goes where a filename would in a link.

(f asset, alt string)

Source from the content-addressed store, hash-verified

102// attribute to fill, so the author cannot supply one, and the name that stands
103// in keeps its extension because it goes where a filename would in a link.
104func newVideoAsset(f asset, alt string) (UserAsset, error) {
105 a := &videoAsset{f}
106 if err := checkMaxSize(a.asset, maxVideoBytes, "videos"); err != nil {
107 return nil, err
108 }
109
110 if alt != "" {
111 return nil, errors.New("cannot set alt text on video")
112 }
113 a.alt = filepath.Base(a.path)
114
115 return a, nil
116}
117
118func (*videoAsset) markdown(assetURL string) string { return assetURL }
119

Callers 1

newAssetFunction · 0.85

Calls 2

checkMaxSizeFunction · 0.85
BaseMethod · 0.80

Tested by

no test coverage detected