fixed minor bug in resourceForkDelete
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2022-10-05 21:36:06 +02:00
parent 6d0bd5906a
commit 6d5439a00a
3 changed files with 43 additions and 2 deletions

View File

@ -62,7 +62,24 @@ func resourceForkRead(d *schema.ResourceData, meta interface{}) (err error) {
func resourceForkDelete(d *schema.ResourceData, meta interface{}) (err error) {
client := meta.(*gitea.Client)
client.DeleteRepo(d.Get(forkOrganization).(string), d.Get(forkRepo).(string))
id, err := strconv.ParseInt(d.Id(), 10, 64)
if err != nil {
return err
}
repo, _, err := client.GetRepoByID(id)
var resp *gitea.Response
resp, err = client.DeleteRepo(repo.Owner.UserName, repo.Name)
if err != nil {
if resp.StatusCode == 404 {
return
} else {
return err
}
}
return
}