Crayon2000/GitConduit

Repository creation HTTP protocol exception: HTTP/1.0 400 Bad Request

Crayon2000 opened this issue · 1 comments

When importing GitHub repositories to Gogs, I get get this error message:
json: cannot unmarshal object into Go struct field CreateRepoOption.license of type string

This is due to the license property not being the same type.

GitHub (https://docs.github.com/en/rest/reference/repos):

      "license": {
        "key": "mit",
        "name": "MIT License",
        "url": "https://api.github.com/licenses/mit",
        "spdx_id": "MIT",
        "node_id": "MDc6TGljZW5zZW1pdA==",
        "html_url": "https://api.github.com/licenses/mit"
      },

Gogs (https://github.com/gogs/docs-api/blob/master/Administration/Repositories.md):

Name Type Description
license string Desired LICENSE template to apply. Use the name of the template. For example, "Apache v2 License" or "MIT

Fixed in commit 5442599.

The license property is no longer part of the JSON string used to create a repository.