From 7da023f345351d62ab6f0659d78d910bb0abecb4 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Mon, 4 May 2026 13:10:01 +0300 Subject: [PATCH] [#7467] forced serving conten-type for xlsx, docx and pptx --- CHANGELOG.md | 2 ++ tools/filesystem/filesystem.go | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1c9cae..82ee43ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Replaced "IBM Plex Sans" text font with "Inter" as there were reports for being difficult to read on dark background as it was too "thin" (specifically on Firefox). _If you are still having issues with the text readability, please open an issue with more details about your OS and browser to try to workaround it._ +- Serve fixed `Content-Type` for `.xlsx`, `.docx` and `.pptx` files to allow previews on iOS ([#7467](https://github.com/pocketbase/pocketbase/discussions/7467)). + ## v0.37.5 diff --git a/tools/filesystem/filesystem.go b/tools/filesystem/filesystem.go index c756c4a7..3b9917f6 100644 --- a/tools/filesystem/filesystem.go +++ b/tools/filesystem/filesystem.go @@ -411,10 +411,20 @@ var inlineServeContentTypes = []string{ // manualExtensionContentTypes is a map of file extensions to content types. var manualExtensionContentTypes = map[string]string{ - ".svg": "image/svg+xml", // (see https://github.com/whatwg/mimesniff/issues/7) - ".css": "text/css", // (see https://github.com/gabriel-vasile/mimetype/pull/113) - ".js": "text/javascript", // (see https://github.com/pocketbase/pocketbase/issues/6597) + // https://github.com/whatwg/mimesniff/issues/7 + ".svg": "image/svg+xml", + + // https://github.com/gabriel-vasile/mimetype/pull/113 + ".css": "text/css", + + // https://github.com/pocketbase/pocketbase/issues/6597 + ".js": "text/javascript", ".mjs": "text/javascript", + + // https://github.com/pocketbase/pocketbase/discussions/7467 + ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", } // forceAttachmentParam is the name of the request query parameter to