fix: 获取exif信息时内存指针错误(invalid memory address or nil pointer dereference)

pull/792/head
ellermister 5 years ago
parent d88f057fa1
commit 187a2005a6

@ -89,8 +89,13 @@ func (fs *FileSystem) GenerateThumbnail(ctx context.Context, file *model.File) {
file.PicInfo = fmt.Sprintf("%d,%d", w, h) file.PicInfo = fmt.Sprintf("%d,%d", w, h)
} }
// 更新文件的图像信息 // 更新文件的图像 exif 信息 开始
// 记录文件句柄位置并还原, 获取 exif 信息 // 记录文件句柄位置并还原, 获取 exif 信息
defer func() {
if err := recover(); err != nil{
util.Log().Warning("照片解析EXIF失败%s", err)
}
}()
currentPosition, err := source.Seek(0, 1) currentPosition, err := source.Seek(0, 1)
source.Seek(0,0) source.Seek(0,0)
x, err := exif.Decode(source) x, err := exif.Decode(source)
@ -121,6 +126,7 @@ func (fs *FileSystem) GenerateThumbnail(ctx context.Context, file *model.File) {
} }
} }
} }
// 更新文件的图像 exif 信息 结束
// 失败时删除缩略图文件 // 失败时删除缩略图文件

Loading…
Cancel
Save