mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-03 08:54:37 -04:00
Add Image Diff for SVG files (#14867)
* Added type sniffer. * Switched content detection from base to typesniffer. * Added GuessContentType to Blob. * Moved image info logic to client. Added support for SVG images in diff. * Restore old blocked svg behaviour. * Added missing image formats. * Execute image diff only when container is visible. * add margin to spinner * improve BIN tag on image diffs * Default to render view. * Show image diff on incomplete diff. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
7979c3654e
commit
8e262104c2
19 changed files with 449 additions and 441 deletions
|
@ -20,6 +20,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/repofiles"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/typesniffer"
|
||||
"code.gitea.io/gitea/modules/upload"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
|
@ -117,8 +118,8 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
|||
buf = buf[:n]
|
||||
|
||||
// Only some file types are editable online as text.
|
||||
if !base.IsRepresentableAsText(buf) {
|
||||
ctx.NotFound("base.IsRepresentableAsText", nil)
|
||||
if !typesniffer.DetectContentType(buf).IsRepresentableAsText() {
|
||||
ctx.NotFound("typesniffer.IsRepresentableAsText", nil)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue