[bugfix] If status URL is empty, use URI instead and don't log unnecessary error (#597)

* test parse status with no URL

* if no status URL is available, use the URI instead
This commit is contained in:
tobi
2022-05-23 17:10:48 +02:00
committed by GitHub
parent 469da93678
commit a09e101931
3 changed files with 72 additions and 3 deletions

View File

@@ -184,10 +184,11 @@ func (c *converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab
l := logrus.WithField("statusURI", status.URI)
// web url for viewing this status
if statusURL, err := ap.ExtractURL(statusable); err != nil {
l.Infof("ASStatusToStatus: error extracting status URL: %s", err)
} else {
if statusURL, err := ap.ExtractURL(statusable); err == nil {
status.URL = statusURL.String()
} else {
// if no URL was set, just take the URI
status.URL = status.URI
}
// the html-formatted content of this status