Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Issue with getting raw files #1843

Open
nchursin opened this issue Dec 5, 2023 · 5 comments
Open

Issue with getting raw files #1843

nchursin opened this issue Dec 5, 2023 · 5 comments

Comments

@nchursin
Copy link

nchursin commented Dec 5, 2023

Hi

I have an issue getting a raw file from a repo. I found the source, but not sure how to fix this.

In GetRawFile there's a URL construction like this:

u := fmt.Sprintf(
      "projects/%s/repository/files/%s",
      PathEscape(project),
      PathEscape(fileName),
)

req, err := s.client.NewRequest(http.MethodGet, u, opt, options)

But NewRequest unescapes the u back to regular URL, which causes 404 in gitlab.

unescaped, err := url.PathUnescape(path)

Any ideas how to fix this, without breaking all the other stuff? :)

@nchursin
Copy link
Author

I actually found the #1675 issue, and it seems like exactly my case. I dumped the request, here's the dump:

Outgoing request:

"GET /api/v4/projects/50796694/repository/files/%2Egitlab%252Fissue_templates%252F%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%20%D0%B4%D0%BB%D1%8F%20%D1%81%D1%82%D0%B0%D1%82%D1%8C%D0%B8%2Emd/raw?ref=main HTTP/1.1\r\nHost: gitlab.com\r\nUser-Agent: go-gitl
ab\r\nAccept: application/json\r\nPrivate-Token: glpat-by7qqecPJJqsTM1MhGTF\r\nAccept-Encoding: gzip\r\n\r\n"
2023/12/16 23:26:52 [telegram.Router.RouteUpdate] error handling telegram update: gitlab.client.CreateArticleTask: GET https://gitlab.com/api/v4/projects/50796694/repository/files/.gitlab/issue_templates/шаблон для статьи.md/raw: 404 {message: 404 
File Not Found}

The issue seems to be somewhere in the retryablehttp, I will dig into this a bit more.

@assembly-deepali
Copy link

assembly-deepali commented Feb 2, 2024

@nchursin did you find a solution to this? hitting the same issue!

@xwbops
Copy link

xwbops commented Sep 23, 2024

@nchursin i have the same problem, do you solution this ?

@nchursin
Copy link
Author

@assembly-deepali @xwbops hey folks

Not really, I just rebuilt this case with my own code

@svanharmelen
Copy link
Member

I think I can take a look, but it would be nice to have a small and simple test case. If anyone can share a few lines with the code they are using including some (may be obfuscated of course) example URLs/paths so that I can reproduce it, that would help me get started.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants