mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-04-26 18:54:27 -05:00
lint fix
Signed-off-by: Aleksandr Dubovikov <d.lexand@gmail.com>
This commit is contained in:
parent
c860640a9b
commit
ea0b25b575
|
@ -183,7 +183,7 @@ func makeUrlPreviewHandler(
|
||||||
result = getPreviewFromHTML(resp, urlParsed)
|
result = getPreviewFromHTML(resp, urlParsed)
|
||||||
if result.ImageUrl != "" {
|
if result.ImageUrl != "" {
|
||||||
// In case of an image in the preview we download it
|
// In case of an image in the preview we download it
|
||||||
if imgReader, err := downloadUrl(result.ImageUrl, time.Duration(cfg.UrlPreviewTimeout)*time.Second); err == nil {
|
if imgReader, derr := downloadUrl(result.ImageUrl, time.Duration(cfg.UrlPreviewTimeout)*time.Second); derr == nil {
|
||||||
mediaData, width, height, _ = downloadAndStoreImage("url_preview", req.Context(), imgReader, cfg, device, db, activeThumbnailGeneration, logger)
|
mediaData, width, height, _ = downloadAndStoreImage("url_preview", req.Context(), imgReader, cfg, device, db, activeThumbnailGeneration, logger)
|
||||||
}
|
}
|
||||||
// We don't show the original image in the preview
|
// We don't show the original image in the preview
|
||||||
|
@ -370,9 +370,9 @@ func downloadAndStoreImage(
|
||||||
|
|
||||||
logger.WithField("mediaID", existingMetadata.MediaID).Debug("media already exists")
|
logger.WithField("mediaID", existingMetadata.MediaID).Debug("media already exists")
|
||||||
// Here we have to read the image to get it's size
|
// Here we have to read the image to get it's size
|
||||||
filePath, err := fileutils.GetPathFromBase64Hash(existingMetadata.Base64Hash, cfg.AbsBasePath)
|
filePath, pathErr := fileutils.GetPathFromBase64Hash(existingMetadata.Base64Hash, cfg.AbsBasePath)
|
||||||
if err != nil {
|
if pathErr != nil {
|
||||||
return nil, width, height, err
|
return nil, width, height, pathErr
|
||||||
}
|
}
|
||||||
width, height, err = thumbnailer.GetImageSize(string(filePath))
|
width, height, err = thumbnailer.GetImageSize(string(filePath))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue