summaryrefslogtreecommitdiff
path: root/MediaController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaController.cs')
-rw-r--r--MediaController.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/MediaController.cs b/MediaController.cs
index 29a8f88..620b3ee 100644
--- a/MediaController.cs
+++ b/MediaController.cs
@@ -64,7 +64,7 @@ public class MediaController : Controller {
if(w > image.Width || h > image.Height)
return BadRequest("Requested thumbnail size is larger than original media");
- int width = (int) (w is not null ? w : image.Width * h / image.Height);
+ int width = (int) (w is not null ? w : image.Width * h / image.Height);
int height = (int) (h is not null ? h : image.Height * w / image.Width);
var thumbPath = config.GetPath(media, width, height);
@@ -166,11 +166,17 @@ public class MediaController : Controller {
.FirstOrDefault(m => m.Checksum == hash);
if(media is null) {
+ var ingestTagDef = db.TagDefinitions
+ .First(td => td.Source == TagSource.Internal && td.Name == "ingest");
+
media = new() {
Checksum = hash,
MimeType = mime,
UploadedFiles = new() {
fileRecord
+ },
+ Tags = new() {
+ new() { TagDefinition = ingestTagDef }
}
};