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

Issue API and Attachments #3690

Closed
4 tasks
madman2021 opened this issue Mar 19, 2018 · 14 comments · Fixed by #21783
Closed
4 tasks

Issue API and Attachments #3690

madman2021 opened this issue Mar 19, 2018 · 14 comments · Fixed by #21783
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented modifies/api This PR adds API routes or modifies them type/enhancement An improvement of existing functionality
Milestone

Comments

@madman2021
Copy link

madman2021 commented Mar 19, 2018

  • Gitea version (or commit ref): 1.3.3
  • Git version: n/a
  • Operating system:n/a
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • [x ] MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • [] Yes (provide example URL)
    • No
    • [ a] Not relevant
  • Log gist:

Description

The Issues API doesn't expose attachments, is this by design?
...

@techknowlogick
Copy link
Member

@madman2021 could be that no one has coded the functionality yet. For example attachments were just exposed for the releases API endpoint in #3478

@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 19, 2018
@lunny lunny added this to the 1.x.x milestone Mar 19, 2018
@lunny
Copy link
Member

lunny commented Mar 29, 2018

I think this has been resolved by #3478. @madman2021 please confirm that.

@jonasfranz
Copy link
Member

@lunny It got only partialy resolved because issues do not provide an assets api.

@madman2021
Copy link
Author

madman2021 commented Apr 26, 2018

As @JonasFranzDEV mentioned, I was hoping I could insert/get attachments to issues via API calls.

Background

On one of our production sites I have a BugReport button in the corner, this allows the user to enter some text and also press a button to capture a JPEG image of the current webpage, the text would be put into the Issue body and the Image added as an attachment. Currently i'm hosting the image in the production site and the link inserted in the body, idealy it would just be added as an attachment.

Hope that helps understand what I'm talking about.

@stale
Copy link

stale bot commented Jan 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 27, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 6, 2019
@mbedded
Copy link

mbedded commented Jul 29, 2019

I would love to see this issue, too. I am creating issues by an REST-API and the attachments are currently added as links to other sources. Attachments can be set for releases. Is it much work to "just make them public" or do some code have to be written?

I am no go-developer but maybe i would like to take a look if i can implement this feature (had to read the contributions guide, too).

EDIT 2019-09-22:
I invested some days to look into that code. Unfortunately i didn't worked with Go yet and i have many issues to set up my environment. I guess there could be some "go specific" things i have to know. It would be nice if some more "Go aware" people could implement this feature :)

@bobemoe
Copy link
Contributor

bobemoe commented Sep 18, 2019

I'm looking for this too. Our automated testing scripts post the test results as comments to issue using the Gitea API, and there are some screenshots that I want to attach to the comment.

@bobemoe
Copy link
Contributor

bobemoe commented Sep 25, 2019

Well, I found a silly workaround!! Not sure I'd recommend it though:

I upload the file to a release, using API: /repos/USER/REPO/releases/1/assets

In the response there is a browser_download_url field that contains a link to the image that you can use to embed it into your comment.

PROBLEMS with this: release 1 is not actually associated with the REPO and I don't really know where the files are going! I can't see them on the actual release on the actual repo its associated with, maybe this is a permission issue. I think if the release was associated with the correct repo they may show up. We don't really want them to show up on a release so thats fine, but really messy.

@guillep2k
Copy link
Member

guillep2k commented Sep 25, 2019

Well, I found a silly workaround!! Not sure I'd recommend it though:

I upload the file to a release, using API: /repos/USER/REPO/releases/1/assets

In the response there is a browser_download_url field that contains a link to the image that you can use to embed it into your comment.

PROBLEMS with this: release 1 is not actually associated with the REPO and I don't really know where the files are going! I can't see them on the actual release on the actual repo its associated with, maybe this is a permission issue. I think if the release was associated with the correct repo they may show up. We don't really want them to show up on a release so thats fine, but really messy.

The fact that you can do this is a bug. You should not rely much on it working after a future upgrade.

EDIT: I see that you've already reported it in #8282

@6543
Copy link
Member

6543 commented Sep 25, 2019

GitNex require a API to manage attachments too ... so I'm linking this issue to here: https://gitea.com/mmarif/GitNex/issues/56

@lordyavin
Copy link

Need the endpoints

  • repos/:owner/:repo/issues/:id/assets
  • repos/:owner/:repo/issues/:id/comments/:id/assets

and the issue/comment model should have an attribute that tells me if there are assets.

@6543 6543 added the modifies/api This PR adds API routes or modifies them label Sep 17, 2020
@andrebruch
Copy link

I have added the feature in #14601.

@lordyavin
Copy link

I have added the feature in #14601.

Too late 😀 I don't use gitea anymore.

@nedvedad
Copy link

nedvedad commented Feb 8, 2021

I have added the feature in #14601.

cool, much appreciated

@6543 6543 modified the milestones: 1.15.0, 1.16.0 Jun 30, 2021
@techknowlogick techknowlogick modified the milestones: 1.16.0, 1.17.0 Nov 23, 2021
@lunny lunny modified the milestones: 1.17.0, 1.18.0 May 25, 2022
@lunny lunny modified the milestones: 1.18.0, 1.19.0 Oct 17, 2022
lunny added a commit that referenced this issue Dec 9, 2022
Close #14601
Fix #3690

Revive of #14601.
Updated to current code, cleanup and added more read/write checks.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andre Bruch <ab@andrebruch.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Norwin <git@nroo.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented modifies/api This PR adds API routes or modifies them type/enhancement An improvement of existing functionality
Projects
None yet