Skip to content

Release asset link type and filepath are not saved when creating a new Release through the API

Summary

When creating a new release using the Create Release API (POST /projects/:id/releases), all asset links are assigned the type other, even when the request body specified a different value (i.e. runbook, image, or package). In addition, the direct_asset_url exactly matches the url parameter, even when a custom filepath parameter is provided.

This bug only happens when creating a new release. Editing existing links using the Release Links API works as expected.

Steps to reproduce

  1. Using the API, create a new release (POST /projects/:id/releases) with an asset link with a non-default type and a custom filepath:

    {
      "name": "v4.2",
      "tag_name": "v4.2",
      "ref": "master",
      "description": "Version 4.2",
      "assets": {
        "links": [
          {
            "name": "An example runbook link",
            "url": "https://example.com/runbook",
            "link_type": "runbook",
            "filepath": "/permanent/path/to/runbook"
          }
        ]
      }
    }
  2. A new release will be successfully created and will be returned in the API response.

  3. In the API response, look at the link_type and direct_asset_url of the newly created asset link.

What is the current bug behavior?

The link_type is other (the default value). direct_asset_url is https://example.com/runbook (the same as url).

What is the expected correct behavior?

The link_type should be runbook as specified in the request JSON. direct_asset_url should be .../-/releases/v4.2/permanent/path/to/runbook.

Output of checks

This bug happens on GitLab.com.

Edited by Nathan Friend