CSV diff: unable to load file from base commit #9576

Closed
opened 2025-11-02 08:43:24 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @otbutz on GitHub (Sep 16, 2022).

Description

Creating a new CSV file as part of a pull request doesn't display the files content in the PRs Files changed tab:

https://try.gitea.io/otbutz99/test/pulls/1/files

The file is valid and renders just fine if viewed directly:

988460b06f/SampleCSVFile_11kb.csv

The CSV diff works fine for me if the content of the CSV is just changed in the PR:

https://try.gitea.io/otbutz99/test/pulls/2/files

Gitea Version

1.17.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image

Git Version

No response

Operating System

No response

How are you running Gitea?

Release binary via systemd

Database

PostgreSQL

Originally created by @otbutz on GitHub (Sep 16, 2022). ### Description Creating a new CSV file as part of a pull request doesn't display the files content in the PRs `Files changed` tab: https://try.gitea.io/otbutz99/test/pulls/1/files The file is valid and renders just fine if viewed directly: https://try.gitea.io/otbutz99/test/src/commit/988460b06f64270788a9f30ed02947e4ab1e6f5a/SampleCSVFile_11kb.csv The CSV diff works fine for me if the content of the CSV is just changed in the PR: https://try.gitea.io/otbutz99/test/pulls/2/files ### Gitea Version 1.17.2 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots ![image](https://user-images.githubusercontent.com/22315436/190609557-702edc88-8498-4143-b25f-4a32b228d689.png) ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Release binary via systemd ### Database PostgreSQL
GiteaMirror added the issue/regressiontype/bug labels 2025-11-02 08:43:24 -06:00
Author
Owner

@KN4CK3R commented on GitHub (Sep 16, 2022):

That's a regression from #19552. This PR enforces base and head to be valid csv files which is not the case if a csv gets created.

@KN4CK3R commented on GitHub (Sep 16, 2022): That's a regression from #19552. This PR enforces base and head to be valid csv files which is not the case if a csv gets created.
Author
Owner

@delvh commented on GitHub (Sep 16, 2022):

Or deleted?

@delvh commented on GitHub (Sep 16, 2022): Or deleted?
Author
Owner

@KN4CK3R commented on GitHub (Sep 16, 2022):

That may fail too.

@KN4CK3R commented on GitHub (Sep 16, 2022): That may fail too.
Author
Owner

@KN4CK3R commented on GitHub (Sep 16, 2022):

What https://github.com/go-gitea/gitea/issues/19530#issuecomment-1113103842 states is wrong because CreateCsvDiff is intended to handle nil readers. I could revert the other PR but without test case for the other issue there may be a new error.

@KN4CK3R commented on GitHub (Sep 16, 2022): What https://github.com/go-gitea/gitea/issues/19530#issuecomment-1113103842 states is wrong because `CreateCsvDiff` is intended to handle `nil` readers. I could revert the other PR but without test case for the other issue there may be a new error.
Author
Owner

@otbutz commented on GitHub (Sep 16, 2022):

That may fail too.

Confirmed: https://try.gitea.io/otbutz99/test/pulls/3/files

@otbutz commented on GitHub (Sep 16, 2022): > That may fail too. Confirmed: https://try.gitea.io/otbutz99/test/pulls/3/files
Author
Owner

@wxiaoguang commented on GitHub (Sep 16, 2022):

Oh yes, I misunderstood the csvReaderFromCommit and CreateCsvDiff logic at that time. Then the question is whether #19552 really fixed the problem (https://github.com/go-gitea/gitea/issues/19530#issuecomment-1112335049 said that the 500 error occurs on deleted files)


Update (2023-02-17): #22946, CreateCsvDiff should be able to process the situation when base and head are both nil.

@wxiaoguang commented on GitHub (Sep 16, 2022): Oh yes, I misunderstood the csvReaderFromCommit and CreateCsvDiff logic at that time. Then the question is whether #19552 really fixed the problem (https://github.com/go-gitea/gitea/issues/19530#issuecomment-1112335049 said that the 500 error occurs on deleted files) ---- Update (2023-02-17): #22946, CreateCsvDiff should be able to process the situation when base and head are both nil.
Author
Owner

@KN4CK3R commented on GitHub (Sep 16, 2022):

I will add a new PR with better error handling which should work in these cases.

@KN4CK3R commented on GitHub (Sep 16, 2022): I will add a new PR with better error handling which should work in these cases.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9576