mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 17:44:59 +09:00
GO-2213 bookmark: check http status
This commit is contained in:
parent
87a88ebf1e
commit
f5c5abc392
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@ package linkpreview
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
@ -63,6 +64,10 @@ func (l *linkPreview) Fetch(ctx context.Context, fetchUrl string) (model.LinkPre
|
|||
}
|
||||
return model.LinkPreview{}, err
|
||||
}
|
||||
|
||||
if resp := rt.lastResponse; resp != nil && resp.StatusCode != http.StatusOK {
|
||||
return model.LinkPreview{}, fmt.Errorf("invalid http code %d", resp.StatusCode)
|
||||
}
|
||||
res := l.convertOGToInfo(fetchUrl, og)
|
||||
if len(res.Description) == 0 {
|
||||
res.Description = l.findContent(rt.lastBody)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue