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

Requesting repository contents by ref does not trim input parameters #2390

Closed
alexandvvvvv opened this issue Jan 10, 2022 · 0 comments · Fixed by #2486
Closed

Requesting repository contents by ref does not trim input parameters #2390

alexandvvvvv opened this issue Jan 10, 2022 · 0 comments · Fixed by #2486
Labels
Type: Bug Something isn't working as documented Type: Feature New feature or request

Comments

@alexandvvvvv
Copy link

The issue was observed on method specified below but would be also produced on some similar methods.

Task<IReadOnlyList> GetAllContentsByRef(string owner, string name, string path, string reference);

Let's have repo "Test_Repo" of "Programmer" owner with following structure:
/src
--/back-end
----code.cs

Let's have 2 branches of this repo: main and dev.

I want to get contents of "src/back-end" folder in "dev" branch.
I call the method with following arguments: "Programmer", "Test_Repo", "src/back-end", "dev".
OK, it returns actual file from dev branch.
But if I pass "src/back-end/" (path ends with slash) then I will get the file from main branch.

As traced with Fiddler, in the second scenario the built URL is ...src/back-end/?ref=dev and the lib sees that it is strange and performs request to check if such resource exists. Obviously it is not found and then it simply throws out ref parameter value and executes request for main branch.

Probably would be better to trim path parameter value in such case.

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented Type: Feature New feature or request and removed category: bug labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented Type: Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants