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

fixes getProjects(namespace, name) with a search #208

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

fixes getProjects(namespace, name) with a search #208

wants to merge 3 commits into from

Conversation

ctabin
Copy link
Contributor

@ctabin ctabin commented May 18, 2017

Hello,

Here is a little contribution to fix the getProject(String namespace, String projectName) method, because in the Gitlab API, you can only access a project by its ID. Hence you need to do a search and compare it with retrieved projects.

Any feedback is welcomed :-)

Best regards,
Cédric

@@ -585,8 +585,15 @@ public GitlabProject getProject(Serializable projectId) throws IOException {
* use namespace & project name to get project
*/
public GitlabProject getProject(String namespace, String projectName) throws IOException{
String tailUrl = GitlabProject.URL + "/" + namespace + "%2F" + projectName;
return retrieve().to(tailUrl, GitlabProject.class);
String fullName = namespace+" / "+projectName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be?

String fullName = namespace + "/" + projectName;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on our internal GitLab and we really have a space between each side of the slash. It's working with the changes.

However, may this be a GitLab configuration ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm. It might just be stripping whitespace?

@ctabin
Copy link
Contributor Author

ctabin commented May 31, 2017

Hi,

I changed slightly the implementation to check the Namespace name. It's safer now :-)

Best,
Cédric

@novalis
Copy link
Contributor

novalis commented Sep 19, 2017

I am able to access a project by namespace and name against Gitlab EE 9.4. It's important to escape the namespace (see #254).

@ctabin
Copy link
Contributor Author

ctabin commented Mar 17, 2019

@novalis I checked with the latest version (4.1.0) against our GitLab CE 11.8.1 and I still have the same problem... Maybe there is a difference on this between CE and EE ?

@novalis
Copy link
Contributor

novalis commented Mar 17, 2019

I won't be able to check this out until early June. Please pester me then. If it's more urgent, maybe @jhedwardyang can take a look. The space seems extremely unlikely, but what do I know?

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

Successfully merging this pull request may close these issues.

3 participants