MCPcopy Index your code
hub / github.com/dagger/dagger / newHTTPFileResult

Method newHTTPFileResult

core/schema/http.go:215–241  ·  view source on GitHub ↗
(
	ctx context.Context,
	srv *dagql.Server,
	fetched *core.HTTPFetchResult,
	permissions int,
	checksum dagql.Optional[dagql.String],
)

Source from the content-addressed store, hash-verified

213}
214
215func (s *httpSchema) newHTTPFileResult(
216 ctx context.Context,
217 srv *dagql.Server,
218 fetched *core.HTTPFetchResult,
219 permissions int,
220 checksum dagql.Optional[dagql.String],
221) (inst dagql.ObjectResult[*core.File], err error) {
222 filePath, _ := fetched.File.File.Peek()
223 outputDigest := hashutil.HashStrings(
224 filePath,
225 fmt.Sprint(permissions),
226 fetched.ContentDigest.String(),
227 fetched.LastModified,
228 string(checksum.GetOr(dagql.String(""))),
229 )
230 inst, err = dagql.NewObjectResultForCurrentCall(ctx, srv, fetched.File)
231 if err != nil {
232 _ = fetched.File.OnRelease(context.WithoutCancel(ctx))
233 return inst, err
234 }
235 inst, err = inst.WithContentDigest(ctx, outputDigest)
236 if err != nil {
237 _ = fetched.File.OnRelease(context.WithoutCancel(ctx))
238 return inst, err
239 }
240 return inst, nil
241}
242
243func parseChecksumArg(checksum *string) (digest.Digest, error) {
244 if checksum == nil || *checksum == "" {

Callers 2

httpMethod · 0.95
httpStateResolveMethod · 0.95

Calls 8

HashStringsFunction · 0.92
StringTypeAlias · 0.92
PeekMethod · 0.80
GetOrMethod · 0.80
StringMethod · 0.65
OnReleaseMethod · 0.65
WithContentDigestMethod · 0.45

Tested by

no test coverage detected