mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 21:12:25 -05:00
[bugfix] return 400 Bad Request on more cases of malformed AS data (#2399)
This commit is contained in:
parent
5fd2e427bb
commit
eb170003b8
47 changed files with 1493 additions and 1013 deletions
|
|
@ -328,29 +328,6 @@ func ExtractAttributedToURI(i WithAttributedTo) (*url.URL, error) {
|
|||
return nil, gtserror.New("couldn't find iri for attributed to")
|
||||
}
|
||||
|
||||
// ExtractPublished extracts the published time from the given
|
||||
// WithPublished. Will return an error if the published property
|
||||
// is not set, is not a time.Time, or is zero.
|
||||
func ExtractPublished(i WithPublished) (time.Time, error) {
|
||||
t := time.Time{}
|
||||
|
||||
publishedProp := i.GetActivityStreamsPublished()
|
||||
if publishedProp == nil {
|
||||
return t, gtserror.New("published prop was nil")
|
||||
}
|
||||
|
||||
if !publishedProp.IsXMLSchemaDateTime() {
|
||||
return t, gtserror.New("published prop was not date time")
|
||||
}
|
||||
|
||||
t = publishedProp.Get()
|
||||
if t.IsZero() {
|
||||
return t, gtserror.New("published time was zero")
|
||||
}
|
||||
|
||||
return t, nil
|
||||
}
|
||||
|
||||
// ExtractIconURI extracts the first URI it can find from
|
||||
// the given WithIcon which links to a supported image file.
|
||||
// Input will look something like this:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue