🐛 Bug fixes and logging
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"git.solsynth.dev/hydrogen/paperclip/pkg/internal/database"
|
||||
"git.solsynth.dev/hydrogen/paperclip/pkg/internal/models"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
@@ -39,6 +40,8 @@ func ReUploadFileToPermanent(meta models.Attachment) error {
|
||||
return fmt.Errorf("attachment isn't in temporary storage, unable to process")
|
||||
}
|
||||
|
||||
meta.Destination = models.AttachmentDstPermanent
|
||||
|
||||
destMap := viper.GetStringMap("destinations.permanent")
|
||||
|
||||
var dest models.BaseDestination
|
||||
@@ -76,6 +79,9 @@ func ReUploadFileToPermanent(meta models.Attachment) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to copy data to dest file: %v", err)
|
||||
}
|
||||
|
||||
database.C.Save(&meta)
|
||||
metadataCache[meta.ID] = meta
|
||||
return nil
|
||||
case models.DestinationTypeS3:
|
||||
var destConfigured models.S3Destination
|
||||
@@ -97,6 +103,9 @@ func ReUploadFileToPermanent(meta models.Attachment) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to upload file to s3: %v", err)
|
||||
}
|
||||
|
||||
database.C.Save(&meta)
|
||||
metadataCache[meta.ID] = meta
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("invalid destination: unsupported protocol %s", dest.Type)
|
||||
|
Reference in New Issue
Block a user