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

Function checkMaxSize

internal/attachments/userasset.go:162–167  ·  view source on GitHub ↗

checkMaxSize rejects a file over the limit for its kind. The limit is inclusive, so the message says at most rather than under.

(a asset, maxBytes int64, kind string)

Source from the content-addressed store, hash-verified

160// checkMaxSize rejects a file over the limit for its kind. The limit is
161// inclusive, so the message says at most rather than under.
162func checkMaxSize(a asset, maxBytes int64, kind string) error {
163 if a.info.Size() <= maxBytes {
164 return nil
165 }
166 return fmt.Errorf("%s: %s must be at most %s", a.path, kind, text.FormatSize(maxBytes))
167}
168
169// supportedContentType maps a file extension to the content type the endpoint
170// expects. The extension is all gh checks, since the endpoint accepts

Callers 2

newImageAssetFunction · 0.85
newVideoAssetFunction · 0.85

Calls 3

FormatSizeFunction · 0.92
SizeMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected