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

Error when importing project #636

Closed
spencergilbert opened this issue Jun 13, 2019 · 7 comments
Closed

Error when importing project #636

spencergilbert opened this issue Jun 13, 2019 · 7 comments
Labels

Comments

@spencergilbert
Copy link

spencergilbert commented Jun 13, 2019

Post https://gitlab.com/api/v4/projects/import: http: ContentLength=141 with Body length 0

I'm receiving the above error when trying to import a project to gitlab.com

git := gitlab.NewClient(nil, "<token>")

	file := "/path/to/exported/project.tar.gz"
	importPath := "imported-project"
	namespace := "my-namepsace"

	opt := gitlab.ImportFileOptions{
		Namespace: &namespace,
		File:      &file,
		Path:      &importPath,
	}

	status, resp, err := (*git.ProjectImportExport).ImportProject(&opt)
	if err != nil {
		fmt.Println(status)
		fmt.Println(resp)
		log.Fatal(err)
	}

This returns <nil>, <nil>, and the above error. Any pointers?

@svanharmelen
Copy link
Member

When having a closer look at the API it looks like uploading a file from your local filesystem is indeed not supported by the current implementation.

I think PR #621 was not been fully tested before it was created as the import file API requires the file to be uploaded using a multipart message which is currently not something that is supported by this package.

@spencergilbert
Copy link
Author

Awesome, wasn't sure if I had been misusing the API there or not. I ended up just using the standard library there for a workaround

@nvanheuverzwijn
Copy link

@svanharmelen If I open a PR to fix this issue, will you do the review ? I have a semi working solution for me but I'd prefer to see that in the upstream lib instead of my hack.

@svanharmelen
Copy link
Member

Of course! PR's are always welcome 👍🏻

@dheitman42
Copy link

Just wanted to check if there has been any progress on this, and to give my +1. I spent a day trying to figure out why my imports were failing. Maybe there should be a comment or something in the docs to indicate that this doesn't work in the meantime, since anyone reading the docs would assume it works as advertised.

@dheitman42
Copy link

Put up a PR here: #1215

Did some quick and dirty testing, but I'll test it more thoroughly after the weekend.

@svanharmelen
Copy link
Member

This issue should be solved by PR #1318 which fixes a couple of upload issues.

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

No branches or pull requests

4 participants