Skip to content

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

@otbutz

Description

@otbutz

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

Git Version

No response

Operating System

No response

How are you running Gitea?

Release binary via systemd

Database

PostgreSQL

Activity

KN4CK3R

KN4CK3R commented on Sep 16, 2022

@KN4CK3R
Member

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.

added
issue/regressionIndicates a previously functioning feature or behavior that has broken or regressed after a change
on Sep 16, 2022
delvh

delvh commented on Sep 16, 2022

@delvh
Member

Or deleted?

KN4CK3R

KN4CK3R commented on Sep 16, 2022

@KN4CK3R
Member

That may fail too.

KN4CK3R

KN4CK3R commented on Sep 16, 2022

@KN4CK3R
Member

What #19530 (comment) 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.

otbutz

otbutz commented on Sep 16, 2022

@otbutz
Author
wxiaoguang

wxiaoguang commented on Sep 16, 2022

@wxiaoguang
Contributor

Oh yes, I misunderstood the csvReaderFromCommit and CreateCsvDiff logic at that time. Then the question is whether #19552 really fixed the problem (#19530 (comment) 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.

KN4CK3R

KN4CK3R commented on Sep 16, 2022

@KN4CK3R
Member

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

added a commit that references this issue on Sep 17, 2022
43c10de
added a commit that references this issue on Sep 17, 2022
7a220b6
added a commit that references this issue on Sep 17, 2022
5cb1037
locked and limited conversation to collaborators on May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/regressionIndicates a previously functioning feature or behavior that has broken or regressed after a changetype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @KN4CK3R@wxiaoguang@otbutz@delvh

      Issue actions

        CSV diff: unable to load file from base commit · Issue #21184 · go-gitea/gitea