mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	Use issue number/index instead of id for API URL. (#3298)
Using the API calls, the issue objects retrieved by
/repos/{owner}/{repo}/issues
contains the wrong value in the "url" field:
it uses the "id" value instead of the "number" value.
For instance, in a new repo in try.gitea.io with just one issue:
[{
  "id": 896,
  "url": "https://try.gitea.io/api/v1/repos/AlbertoGP/uno/issues/896",
  "number": 1,
   ...
}]
The given URL does not work, but if you replace the "896" by "1" it
does.
	
	
This commit is contained in:
		
					parent
					
						
							
								9f8349af06
							
						
					
				
			
			
				commit
				
					
						30fb81c71e
					
				
			
		
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -248,7 +248,7 @@ func (issue *Issue) GetIsRead(userID int64) error {
 | 
			
		|||
 | 
			
		||||
// APIURL returns the absolute APIURL to this issue.
 | 
			
		||||
func (issue *Issue) APIURL() string {
 | 
			
		||||
	return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.ID))
 | 
			
		||||
	return issue.Repo.APIURL() + "/" + path.Join("issues", fmt.Sprint(issue.Index))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HTMLURL returns the absolute URL to this issue.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue