Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images and other binary files not shown in diff #13060

Closed
2 of 7 tasks
mleyen opened this issue Oct 7, 2020 · 7 comments · Fixed by #13136
Closed
2 of 7 tasks

Images and other binary files not shown in diff #13060

mleyen opened this issue Oct 7, 2020 · 7 comments · Fixed by #13136
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself type/bug
Milestone

Comments

@mleyen
Copy link

mleyen commented Oct 7, 2020

  • Gitea version (or commit ref): 1.12.5
  • Git version: 2.25.1
  • Operating system: Ubuntu 20.04.1 LTS
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
  • Log gist:

Description

Images no longer display in the Web interface when viewing a commit's diff. Instead, they only display an empty line with the "BIN" label, and no filename. This is true for any binary file, as well as empty files.

Screenshots

test

@zeripath
Copy link
Contributor

zeripath commented Oct 7, 2020

Damn this one is gonna be something to do with the new diff header reading code.

@zeripath
Copy link
Contributor

zeripath commented Oct 7, 2020

The problem will be in here

func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*Diff, error) {

And the issue will be that the bin diff isn't matched properly.

This is really a lot of fun because it appears that the diff is:

diff --git a/gitea-sm.png b/gitea-sm.png
new file mode 100644
index 0000000..0ae375c
Binary files /dev/null and b/gitea-sm.png differ

Similarly for the empty file problem:

diff --git a/.gitkeep b/.gitkeep
new file mode 100644
index 0000000..e69de29

We can't easily determine the file name from the diff line:

Consider https://try.gitea.io/arandomer/pathological/commit/f4c9cf62d8e5c8720e2e11d608306065da05343d its diff is:

diff --git a/b b/b b/b b/b b/b b/b
similarity index 100%
rename from b b/b
rename to b b/b b/b b/b
diff --git a/b b/b b/b b/b b/b b/b
similarity index 100%
rename from b
rename to b b/b b/b b/b b/b

I just don't know how we're supposed to be able to parse these diffs in a non-breaking way...

@zeripath
Copy link
Contributor

zeripath commented Oct 7, 2020

Ah --src-prefix and --dst-prefix can be used to force the damned paths to be escaped.

Now just need to check if we can use those in early gits.

@lunny lunny added the type/bug label Oct 8, 2020
@lunny lunny added this to the 1.12.6 milestone Oct 8, 2020
@lunny lunny added the issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself label Oct 8, 2020
@ratuka
Copy link

ratuka commented Oct 13, 2020

Any news about this?

@Vangelis66
Copy link

@wolfbeast:

This bug is still present in the newly migrated (GitHub -> Gitea 1.12.5) MoonchildProductions repositories, e.g.

https://repo.palemoon.org/MoonchildProductions/Pale-Moon/commit/85f7050

GiteaBug

Just thought you should know... 😄
Best regards.

@wolfbeast
Copy link

Please don't @ mention me unless you explicitly need my input.

@techknowlogick
Copy link
Member

Locking this as the issue is closed, and will be included in the next release.

@go-gitea go-gitea locked and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants