( ctx context.Context, srv *dagql.Server, fetched *core.HTTPFetchResult, permissions int, checksum dagql.Optional[dagql.String], )
| 213 | } |
| 214 | |
| 215 | func (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 | |
| 243 | func parseChecksumArg(checksum *string) (digest.Digest, error) { |
| 244 | if checksum == nil || *checksum == "" { |
no test coverage detected