You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Here we might not know the real filename, and it's quite inefficient to detect the mine type by pre-fetching the object head.
290
+
// So we just do a quick detection by extension name, at least if works for the "View Raw File" for an LFS file on the Web UI.
291
+
// Detect content type by extension name, only support the well-known safe types for inline rendering.
292
+
// TODO: OBJECT-STORAGE-CONTENT-TYPE: need a complete solution and refactor for Azure in the future
293
+
ext:=path.Ext(name)
294
+
inlineExtMimeTypes:=map[string]string{
295
+
".png": "image/png",
296
+
".jpg": "image/jpeg",
297
+
".jpeg": "image/jpeg",
298
+
".gif": "image/gif",
299
+
".webp": "image/webp",
300
+
".avif": "image/avif",
301
+
// ATTENTION! Don't support unsafe types like HTML/SVG due to security concerns: they can contain JS code, and maybe they need proper Content-Security-Policy
302
+
// HINT: PDF-RENDER-SANDBOX: PDF won't render in sandboxed context, it seems fine to render it inline
303
+
".pdf": "application/pdf",
304
+
305
+
// TODO: refactor with "modules/public/mime_types.go", for example: "DetectWellKnownSafeInlineMimeType"
0 commit comments