| 447 | } |
| 448 | |
| 449 | func (r *Reader) readNodeContent(ctx context.Context, node Node) ([]byte, error) { |
| 450 | if node, isRemote := node.(RemoteNode); isRemote { |
| 451 | return r.readRemoteNodeContent(ctx, node) |
| 452 | } |
| 453 | |
| 454 | // Read the Taskfile |
| 455 | b, err := node.Read() |
| 456 | if err != nil { |
| 457 | return nil, err |
| 458 | } |
| 459 | |
| 460 | // If the given checksum doesn't match the sum pinned in the Taskfile |
| 461 | checksum := checksum(b) |
| 462 | if !node.Verify(checksum) { |
| 463 | return nil, &errors.TaskfileDoesNotMatchChecksum{ |
| 464 | URI: node.Location(), |
| 465 | ExpectedChecksum: node.Checksum(), |
| 466 | ActualChecksum: checksum, |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | return b, nil |
| 471 | } |
| 472 | |
| 473 | func (r *Reader) readRemoteNodeContent(ctx context.Context, node RemoteNode) ([]byte, error) { |
| 474 | cache := NewCacheNode(node, r.tempDir) |