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

Attachments In Review Comment Break With Edit #24195

Closed
kdumontnu opened this issue Apr 18, 2023 · 3 comments · Fixed by #24202
Closed

Attachments In Review Comment Break With Edit #24195

kdumontnu opened this issue Apr 18, 2023 · 3 comments · Fixed by #24202
Assignees
Labels

Comments

@kdumontnu
Copy link
Contributor

kdumontnu commented Apr 18, 2023

Description

To Reproduce

  • Submit a review on design review with image attachments (I've only verified paste from clipboard)
    • images will automatically be inlined in markdown
  • Edit the comment and delete one of the images
  • All of the image/attachment links break

It seems as if all of the attachments are deleted when the review is edited.

Related to: #23290 and #24196

Gitea Version

1.18 and 1.20 (try.gitea)

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Paste some images (note: attachments aren't indicated)
Screenshot 2023-04-18 at 2 42 28 PM
Edit the review comment
Screenshot 2023-04-18 at 2 43 24 PM
Screenshot 2023-04-18 at 2 43 39 PM
Screenshot 2023-04-18 at 2 43 52 PM
All attachments are broken
Screenshot 2023-04-18 at 2 44 05 PM

Git Version

No response

Operating System

No response

How are you running Gitea?

https://try.gitea.io/kdumontnu/test/pulls/2

Database

None

@jtran
Copy link
Contributor

jtran commented Apr 18, 2023

Until proper editing of attachments on reviews is implemented, would adding ignore_attachments: true to the request fix the issue?

@wxiaoguang
Copy link
Contributor

Good catch, the "attachment removal" code was already quite buggy before (this bug is not the first time appearing....)

I guess we need to rewrite it.

I am working on it.

@wxiaoguang
Copy link
Contributor

I guess this PR could fix the bug: Fix issue attachment handling #24202

silverwind added a commit that referenced this issue Apr 20, 2023
Close #24195

Some of the changes are taken from my another fix
f07b0de
in #20147 (although that PR was discarded ....)


The bug is:

1. The old code doesn't handle `removedfile` event correctly
2. The old code doesn't provide attachments for type=CommentTypeReview


This PR doesn't intend to refactor the "upload" code to a perfect state
(to avoid making the review difficult), so some legacy styles are kept.

---------

Co-authored-by: silverwind <[email protected]>
Co-authored-by: Giteabot <[email protected]>
silverwind added a commit that referenced this issue Apr 20, 2023
Backport #24202

Close #24195

Fix the bug:

1. The old code doesn't handle `removedfile` event correctly
2. The old code doesn't provide attachments for type=CommentTypeReview

---------

Co-authored-by: silverwind <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants