Skip to content

Trying to make a comment raises the error: line_code=>["can't be blank", "must be a valid line code"] #386

Description

@eonpatapon

Prerequsities

  • I'm on the latest version of the plugin
  • I've installed the required dependencies
  • I've run :h gitlab.nvim.troubleshooting and followed the steps there

Setup Configuration and Environment

require("gitlab").setup({debug = { go_request = true, go_response = true, request = true, response = true, gitlab_request = true, gitlab_response = true, }})

Otherwise, only creds are setup

Bug Description

I'm using a private gitlab enterprise server and this plugin at 38bde8a0e4a982329ab4dc4f214f3f06dfc4e4fd

So I'm able to open a review, then in the review diff in visual mode I select one line (same with multiple lines) and try to add a comment with <leader>c.

The request is like so:

-- REQUEST TO GO SERVER --
POST /mr/comment HTTP/1.1
Host: localhost:38973
Accept: */*
Content-Length: 444
Content-Type: application/x-www-form-urlencoded
Private-Token: REDACTED
User-Agent: curl/8.7.1

{"file_name":"xxxx","base_commit_sha":"ba44dad8a1016eb24b3b28948dbd8be10e51d727","start_commit_sha":"ba44dad8a1016eb24b3b28948dbd8be10e51d727","head_commit_sha":"419920e26de375a8094e269ae55907410a98bc1e","comment":"Test","new_line":309,"old_line":310,"type":"text","line_range":{"end":{"new_line":309,"old_line":310,"type":"old"},"start":{"new_line":309,"old_line":310,"type":"old"}}}

-- REQUEST TO GITLAB --
POST /api/v4/projects/373/merge_requests/747/discussions HTTP/1.1
Host: XXXX
Accept: application/json
Content-Type: application/json
Private-Token: REDACTED
User-Agent: go-gitlab

{"body":"Test","position":{"base_sha":"ba44dad8a1016eb24b3b28948dbd8be10e51d727","head_sha":"419920e26de375a8094e269ae55907410a98bc1e","start_sha":"ba44dad8a1016eb24b3b28948dbd8be10e51d727","new_path":"xxxx","old_path":"xxxx","position_type":"text","new_line":309,"old_line":310,"line_range":{"start":{"line_code":"ae08d147731326a82a8067d18ce9d6c724770eb3_310_309","type":"old"},"end":{"line_code":"ae08d147731326a82a8067d18ce9d6c724770eb3_310_309","type":"old"}}}}

Response:

-- RESPONSE FROM GITLAB --
HTTP/1.1 400 Bad Request
Content-Length: 102
Cache-Control: no-cache
Connection: keep-alive
Content-Type: application/json
Date: Fri, 04 Oct 2024 12:21:33 GMT
Server: nginx
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Gitlab-Meta: {"correlation_id":"01J9BQMTA4XRN6STGJJYC4K3D1","version":"1"}
X-Request-Id: 01J9BQMTA4XRN6STGJJYC4K3D1
X-Runtime: 0.153909

{"message":"400 Bad request - Note {:line_code=>[\"can't be blank\", \"must be a valid line code\"]}"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions