Truncate data from OpenGraph metadata (#10532)
* Truncate strings from OpenGraph metada * remove unwanted opengraph fields, limit to 1 image * test helper functions * Add truncating test * fix typo * change test into not comparing for the pointer value * truncate only once * only shorten fields that were already present * set maximum of 5 images * fix original tests * fix test * limit to 5 images * fix typo * place functions below types, simplify function commentaries * Rewrite how to empty opengraph's structure
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
88202a76d9
Коммит
ad69002f9e
@@ -379,6 +379,7 @@ func (a *App) getLinkMetadata(requestURL string, timestamp int64, isNewPost bool
|
||||
// Parse the data
|
||||
og, image, err = a.parseLinkMetadata(requestURL, body, contentType)
|
||||
}
|
||||
og = model.TruncateOpenGraph(og) // remove unwanted length of texts
|
||||
|
||||
// Write back to cache and database, even if there was an error and the results are nil
|
||||
cacheLinkMetadata(requestURL, timestamp, og, image)
|
||||
|
||||
Ссылка в новой задаче
Block a user