Merge pull request 'fix repo_get_raw_file{_or_lfs} not returning Vec<u8>' (#47) from raw-file-fix into main
				
					
				
			Reviewed-on: https://codeberg.org/Cyborus/forgejo-api/pulls/47
This commit is contained in:
		
						commit
						43e2f85b82
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -4309,13 +4309,13 @@ impl crate::Forgejo {
 | 
			
		|||
        repo: &str,
 | 
			
		||||
        filepath: &str,
 | 
			
		||||
        query: RepoGetRawFileOrLfsQuery,
 | 
			
		||||
    ) -> Result<(), ForgejoError> {
 | 
			
		||||
    ) -> Result<Vec<u8>, ForgejoError> {
 | 
			
		||||
        let request = self
 | 
			
		||||
            .get(&format!("repos/{owner}/{repo}/media/{filepath}?{query}"))
 | 
			
		||||
            .build()?;
 | 
			
		||||
        let response = self.execute(request).await?;
 | 
			
		||||
        match response.status().as_u16() {
 | 
			
		||||
            200 => Ok(()),
 | 
			
		||||
            200 => Ok(response.bytes().await?[..].to_vec()),
 | 
			
		||||
            _ => Err(ForgejoError::UnexpectedStatusCode(response.status())),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -5235,13 +5235,13 @@ impl crate::Forgejo {
 | 
			
		|||
        repo: &str,
 | 
			
		||||
        filepath: &str,
 | 
			
		||||
        query: RepoGetRawFileQuery,
 | 
			
		||||
    ) -> Result<(), ForgejoError> {
 | 
			
		||||
    ) -> Result<Vec<u8>, ForgejoError> {
 | 
			
		||||
        let request = self
 | 
			
		||||
            .get(&format!("repos/{owner}/{repo}/raw/{filepath}?{query}"))
 | 
			
		||||
            .build()?;
 | 
			
		||||
        let response = self.execute(request).await?;
 | 
			
		||||
        match response.status().as_u16() {
 | 
			
		||||
            200 => Ok(()),
 | 
			
		||||
            200 => Ok(response.bytes().await?[..].to_vec()),
 | 
			
		||||
            _ => Err(ForgejoError::UnexpectedStatusCode(response.status())),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9112,6 +9112,7 @@
 | 
			
		|||
    },
 | 
			
		||||
    "/repos/{owner}/{repo}/media/{filepath}": {
 | 
			
		||||
      "get": {
 | 
			
		||||
        "produces": ["*/*"],
 | 
			
		||||
        "tags": ["repository"],
 | 
			
		||||
        "summary": "Get a file or it's LFS object from a repository",
 | 
			
		||||
        "operationId": "repoGetRawFileOrLFS",
 | 
			
		||||
| 
						 | 
				
			
			@ -11172,7 +11173,7 @@
 | 
			
		|||
    },
 | 
			
		||||
    "/repos/{owner}/{repo}/raw/{filepath}": {
 | 
			
		||||
      "get": {
 | 
			
		||||
        "produces": ["application/json"],
 | 
			
		||||
        "produces": ["*/*"],
 | 
			
		||||
        "tags": ["repository"],
 | 
			
		||||
        "summary": "Get a file from a repository",
 | 
			
		||||
        "operationId": "repoGetRawFile",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue