Skip to content

fix: Preserve match data in endpoint interpolation functions#23

Open
jasonatwell wants to merge 1 commit into
isamert:mainfrom
jasonatwell:fix-match-data-in-endpoint-interpolation-fn
Open

fix: Preserve match data in endpoint interpolation functions#23
jasonatwell wants to merge 1 commit into
isamert:mainfrom
jasonatwell:fix-match-data-in-endpoint-interpolation-fn

Conversation

@jasonatwell

Copy link
Copy Markdown

The #{project} and #{group} placeholders are replaced via s-replace-regexp with function replacements, and replace-regexp-in-string uses its own match data to splice the function's return value back into the string. lab--project-path runs regexps of its own which clobber that match data, so the replacement got spliced over the wrong span of the endpoint: projects/#{projname%2Fui%2Frepo-name}/merge_requests. The stray # then truncates the request path as a URL fragment, so GitLab receives POST /api/v4/projects and rejects it with "name, path are missing". SSH/SCP-style remotes dodge the bug by taking a different parse path, which is why it only shows up with https remotes. Wrap both replacement functions in save-match-data.

disclaimer: 100% vibe coded by Fable 5

The `#{project}` and `#{group}` placeholders are replaced via
`s-replace-regexp' with function replacements, and
`replace-regexp-in-string' uses its own match data to splice the
function's return value back into the string. `lab--project-path'
runs regexps of its own which clobber that match data, so the
replacement got spliced over the wrong span of the endpoint:

  projects/#{projname%2Fui%2Frepo-name}/merge_requests

The stray `#' then truncates the request path as a URL fragment, so
GitLab receives POST /api/v4/projects and rejects it with "name, path
are missing". SSH/SCP-style remotes dodge the bug by taking a
different parse path, which is why it only shows up with https
remotes. Wrap both replacement functions in `save-match-data'.
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

Successfully merging this pull request may close these issues.

2 participants