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

RepositoryFileApi.updateFile PUT's to the wrong endpoint #65

Closed
richardmward opened this issue Aug 18, 2017 · 7 comments
Closed

RepositoryFileApi.updateFile PUT's to the wrong endpoint #65

richardmward opened this issue Aug 18, 2017 · 7 comments

Comments

@richardmward
Copy link

I think that org.gitlab4j.api.RepositoryFileApi.updateFile is sending it's PUT request to the wrong endpoint. I believe that:

put(Response.Status.OK, form.asMap(), "projects", projectId, "repository", "files", urlEncode(file.getFilePath()))

should be:

put(Response.Status.OK, form.asMap(), "projects", projectId, "repository", "files")

and that org.gitlab4j.api.RepositoryFileApi.file2form(RepositoryFile, String, String) should include:

addFormParam(form, "file_path", filepath, true);
@richardmward
Copy link
Author

The same appears to be true of the org.gitlab4j.api.RepositoryFileApi.createFile method too.

@gmessner
Copy link
Collaborator

@richardmward
Per the GitLab API docs, both the update and create call should have the file path in URI. See the following links:
Create new file in repository
Update existing file in repository

Are these not working for you? If not, what is the version of the GitLab server you are going at?

@richardmward
Copy link
Author

Ah, of course. I should have said, I am working against a V3 API at the moment, and was reading the V3 API docs - I should have thought to check to see if it had changed in V4, which it has.

Create V3
Update V3

@gmessner
Copy link
Collaborator

@richardmward
I can modify the methods to be version aware, will make that change in the next day or so.

@freeroy
Copy link

freeroy commented Aug 24, 2017

I catch this error too. my gitlab version is 8.3.2 and 7.11.4

please help~

@gmessner
Copy link
Collaborator

Support has been added for V3 for create, update, and delete repository file. The latest release (4.4.7) includes these updates.

@gmessner
Copy link
Collaborator

@freeroy
Just wanted to let you know that V3 support has been added. Unfortunately, I cannot test it since I do not have access to an older GitLab server, let me know if you run into any problems.

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

No branches or pull requests

3 participants