🐛 Bug fixes and optimization
This commit is contained in:
@@ -53,7 +53,10 @@ func ScanUnanalyzedFileFromDatabase() {
|
||||
}
|
||||
|
||||
var attachments []models.Attachment
|
||||
if err := database.C.Where("destination = ? OR is_analyzed = ?", models.AttachmentDstTemporary, false).Find(&attachments).Error; err != nil {
|
||||
if err := database.C.
|
||||
Where("is_uploaded = ?", true).
|
||||
Where("destination = ? OR is_analyzed = ?", models.AttachmentDstTemporary, false).
|
||||
Find(&attachments).Error; err != nil {
|
||||
log.Error().Err(err).Msg("Scan unanalyzed files from database failed...")
|
||||
return
|
||||
}
|
||||
@@ -93,7 +96,9 @@ func ScanUnanalyzedFileFromDatabase() {
|
||||
}
|
||||
|
||||
func AnalyzeAttachment(file models.Attachment) error {
|
||||
if file.Destination != models.AttachmentDstTemporary {
|
||||
if !file.IsUploaded {
|
||||
return fmt.Errorf("file isn't finish multipart upload")
|
||||
} else if file.Destination != models.AttachmentDstTemporary {
|
||||
return fmt.Errorf("attachment isn't in temporary storage, unable to analyze")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user