MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / DownloadAsset

Method DownloadAsset

internal/pluginstore/github.go:116–128  ·  view source on GitHub ↗
(ctx context.Context, asset ReleaseAsset)

Source from the content-addressed store, hash-verified

114}
115
116func (c Client) DownloadAsset(ctx context.Context, asset ReleaseAsset) ([]byte, error) {
117 downloadURL := strings.TrimSpace(asset.BrowserDownloadURL)
118 apiURL := strings.TrimSpace(asset.APIURL)
119 if downloadURL == "" || c.releaseAssetAPIAuthenticated(apiURL) {
120 if apiURL != "" {
121 downloadURL = apiURL
122 }
123 }
124 if downloadURL == "" {
125 return nil, fmt.Errorf("asset %q missing download url", asset.Name)
126 }
127 return c.get(ctx, downloadURL, "application/octet-stream", RequestKindArtifact, 0)
128}
129
130func (c Client) releaseAssetAPIAuthenticated(apiURL string) bool {
131 apiURL = strings.TrimSpace(apiURL)

Calls 2

getMethod · 0.95