diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 01a37c8..5b7d1fa 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,13 +4,7 @@
-
-
-
-
-
-
-
+
diff --git a/pkg/server/attachments_api.go b/pkg/server/attachments_api.go
index 778f5ee..37323b2 100644
--- a/pkg/server/attachments_api.go
+++ b/pkg/server/attachments_api.go
@@ -40,7 +40,11 @@ func openAttachment(c *fiber.Ctx) error {
case models.DestinationTypeLocal:
var destConfigured models.LocalDestination
_ = jsoniter.Unmarshal(rawDest, &destConfigured)
- return c.SendFile(filepath.Join(destConfigured.Path, metadata.Uuid))
+ if len(metadata.MimeType) > 0 {
+ c.Set(fiber.HeaderContentType, metadata.MimeType)
+ }
+ return c.SendFile(filepath.Join(destConfigured.Path, metadata.Uuid), false)
+
case models.DestinationTypeS3:
var destConfigured models.S3Destination
_ = jsoniter.Unmarshal(rawDest, &destConfigured)
@@ -52,6 +56,7 @@ func openAttachment(c *fiber.Ctx) error {
destConfigured.Endpoint,
url.QueryEscape(filepath.Join(destConfigured.Path, metadata.Uuid)),
))
+
default:
return fmt.Errorf("invalid destination: unsupported protocol %s", destParsed.Type)
}
diff --git a/settings.toml b/settings.toml
index c2ef67d..e43f6d1 100644
--- a/settings.toml
+++ b/settings.toml
@@ -26,12 +26,12 @@ access_token_duration = 300
refresh_token_duration = 2592000
[database]
-dsn = "host=localhost dbname=hy_paperclip port=5432 sslmode=disable"
+dsn = "host=localhost user=postgres password=password dbname=hy_paperclip port=5432 sslmode=disable"
prefix = "paperclip_"
[destinations.local]
type = "local"
-path = "uploads"
+path = "/uploads"
[destinations.s3]
type = "s3"