From 4662b035014fd0eec503e8a11752af7d38aef3f2 Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Wed, 26 Jan 2022 18:45:44 +0500 Subject: [PATCH] Adding gif support for boards (#2126) * Adding gif support for boards * Updating api --- server/api/api.go | 5 +++++ webapp/src/components/content/imageElement.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/server/api/api.go b/server/api/api.go index f9a37a603..9ae0e0920 100644 --- a/server/api/api.go +++ b/server/api/api.go @@ -1320,6 +1320,7 @@ func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) { // - application/json // - image/jpg // - image/png + // - image/gif // parameters: // - name: workspaceID // in: path @@ -1370,6 +1371,10 @@ func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) { contentType = "image/png" } + if fileExtension == "gif" { + contentType = "image/gif" + } + w.Header().Set("Content-Type", contentType) fileReader, err := a.app.GetFileReader(workspaceID, rootID, filename) diff --git a/webapp/src/components/content/imageElement.tsx b/webapp/src/components/content/imageElement.tsx index 9b46d329a..ffdc8eb8e 100644 --- a/webapp/src/components/content/imageElement.tsx +++ b/webapp/src/components/content/imageElement.tsx @@ -56,7 +56,7 @@ contentRegistry.registerContentType({ block.fields.fileId = fileId || '' resolve(block) }, - '.jpg,.jpeg,.png') + '.jpg,.jpeg,.png,.gif') }, )