Skip to content

Commit 93d963b

Browse files
committed
fix
1 parent 64f8929 commit 93d963b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/storage/minio.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,15 @@ func (m *MinioStorage) URL(storePath, name, method string, serveDirectReqParams
287287
}
288288

289289
// 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 a LFS file on the Web UI.
291-
// Detect content type by extension name
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.
292292
ext := path.Ext(name)
293293
inlineExtMimeTypes := map[string]string{
294294
".png": "image/png",
295295
".jpg": "image/jpeg",
296296
".jpeg": "image/jpeg",
297297
".gif": "image/gif",
298-
".webp": "iamge/webp",
298+
".webp": "image/webp",
299299
".avif": "image/avif",
300300
// don't support SVG because of security concerns: it can contain JS code, and maybe it needs proper Content-Security-Policy
301301
// HINT: PDF-RENDER-SANDBOX: PDF won't render in sandboxed context, it seems fine to render it inline

routers/web/repo/view.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ func getFileReader(ctx gocontext.Context, repoID int64, blob *git.Blob) (buf []b
9595

9696
meta, err := git_model.GetLFSMetaObjectByOid(ctx, repoID, pointer.Oid)
9797
if err != nil { // fallback to a plain file
98+
fi.lfsMeta = &pointer
9899
log.Warn("Unable to access LFS pointer %s in repo %d: %v", pointer.Oid, repoID, err)
99100
return buf, dataRc, fi, nil
100101
}

0 commit comments

Comments
 (0)