diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mime.zig | 3 | ||||
| -rw-r--r-- | src/routes/api/image/load.zig | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/mime.zig b/src/mime.zig index 0082f80..c60ab74 100644 --- a/src/mime.zig +++ b/src/mime.zig @@ -33,7 +33,8 @@ pub const content_types = std.StaticStringMap([]const u8).initComptime(.{ .{ ".ico", "image/vnd.microsoft.icon" }, .{ ".ics", "text/calendar" }, .{ ".jar", "application/java-archive" }, - .{ ".jpeg, .jpg", "image/jpeg" }, + .{ ".jpeg", "image/jpeg" }, + .{ ".jpg", "image/jpeg" }, .{ ".js", "text/javascript" }, .{ ".json", "application/json" }, .{ ".jsonld", "application/ld+json" }, diff --git a/src/routes/api/image/load.zig b/src/routes/api/image/load.zig index 1b2a3e2..3ef25d6 100644 --- a/src/routes/api/image/load.zig +++ b/src/routes/api/image/load.zig @@ -3,11 +3,13 @@ const std = @import("std"); const memora = @import("memora"); const Context = memora.Context; const Storage = memora.Storage; +const mime = @import("../../../mime.zig"); pub const access = .users; pub fn get(ctx: *Context) !memora.Stream { const id = ctx.request.head.target["/api/image/load/".len..]; var image = Storage.Image { .id = id, .timestamp = null }; + ctx.response.headers.content_type = comptime mime.content_types.get(".jpeg") orelse unreachable; return .from_file(try image.file(ctx.storage)); } |