Skip to content

Commit

Permalink
don't copy response for og:image if status not success
Browse files Browse the repository at this point in the history
  • Loading branch information
Southclaws committed Dec 10, 2023
1 parent 0670dc0 commit fa32eb0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/services/hydrator/fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func (s *service) copy(ctx context.Context, url string) (*asset.Asset, error) {
return nil, fault.Wrap(err, fctx.With(ctx))
}

if resp.StatusCode != http.StatusOK {
ctx = fctx.WithMeta(ctx, "status", resp.Status)
return nil, fault.Wrap(fault.New("failed to get"), fctx.With(ctx))
}

a, err := s.as.Upload(ctx, resp.Body, resp.ContentLength)
if err != nil {
return nil, fault.Wrap(err, fctx.With(ctx))
Expand Down

1 comment on commit fa32eb0

@vercel
Copy link

@vercel vercel bot commented on fa32eb0 Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.