Error 400 when on a branch that has special chars
Summary
When in a branch with a special name the extensions simply goes haywire. It keeps trying to communicate with Gitlab but keeps receiving a ton of 400 errors.
Steps to reproduce
Right now I'm in a branch called feature/ch38/add-fn-para-criar-novo-usuário
(which is in Portuguese and has an accent in one of the words).
- Moving to a branch that has special chars already does the job
What is the current bug behavior?
Told above.
What is the expected correct behavior?
It should work as any other branch, regardless of the name.
Relevant logs and/or screenshots
Found https://gitlab.com in the PAT list and git remotes, using it as the instanceUrl
{
"userMessage": "Failed to parse GitLab API response",
"errorMessage": "Unexpected token < in JSON at position 0",
"stack": [
"SyntaxError: Unexpected token < in JSON at position 0",
"\tat JSON.parse (<anonymous>)",
"\tat Object.config.transform (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/out/src/gitlab_service.js:63:36)",
"\tat /home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request-promise-core/lib/plumbing.js:94:46",
"\tat Promise.cancellationExecute [as _execute] (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/debuggability.js:406:9)",
"\tat Promise._resolveFromExecutor (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/promise.js:518:18)",
"\tat new Promise (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/promise.js:103:10)",
"\tat Request.plumbing.callback (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request-promise-core/lib/plumbing.js:93:18)",
"\tat Request.RP$callback [as _callback] (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request-promise-core/lib/plumbing.js:46:31)",
"\tat Request.self.callback (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request/request.js:185:22)",
"\tat Request.emit (events.js:315:20)",
"\tat Request.<anonymous> (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request/request.js:1154:10)",
"\tat Request.emit (events.js:315:20)",
"\tat IncomingMessage.<anonymous> (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request/request.js:1076:12)",
"\tat Object.onceWrapper (events.js:421:28)",
"\tat IncomingMessage.emit (events.js:327:22)",
"\tat endReadableNT (_stream_readable.js:1220:12)",
"\tat processTicksAndRejections (internal/process/task_queues.js:84:21)"
],
"additionalInfo": "Response body: <!DOCTYPE html>\n<html>\n<head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1\" name=\"viewport\">\n <title>400 Bad Request</title>\n <style>...</style>\n</head>\n\n<body>\n <h1>\n <img src=\"...\" alt=\"GitLab Logo\" /><br />\n 400\n </h1>\n <div class=\"container\">\n <h3>Your browser sent an invalid request.</h3>\n <hr />\n <p>Please contact your GitLab administrator if you think this is a mistake.</p>\n </div>\n</body>\n</html>\n<html>\n\nRequest URL: https://gitlab.com/api/v4/projects/.../pipelines?ref=feature/ch38/add-fn-para-criar-novo-usuário"
}
400 - "<!DOCTYPE html>\n<html>\n<head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1\" name=\"viewport\">\n <title>400 Bad Request</title>\n <style>\n body {\n color: #666;\n text-align: center;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n margin: auto;\n font-size: 14px;\n }\n\n h1 {\n font-size: 56px;\n line-height: 100px;\n font-weight: normal;\n color: #456;\n }\n\n h2 {\n font-size: 24px;\n color: #666;\n line-height: 1.5em;\n }\n\n h3 {\n color: #456;\n font-size: 20px;\n font-weight: normal;\n line-height: 28px;\n }\n\n hr {\n max-width: 800px;\n margin: 18px auto;\n border: 0;\n border-top: 1px solid #EEE;\n border-bottom: 1px solid white;\n }\n\n img {\n max-width: 40vw;\n }\n\n .container {\n margin: auto 20px;\n }\n </style>\n</head>\n\n<body>\n <h1>\n <img src=\"...\" alt=\"GitLab Logo\" /><br />\n 400\n </h1>\n <div class=\"container\">\n <h3>Your browser sent an invalid request.</h3>\n <hr />\n <p>Please contact your GitLab administrator if you think this is a mistake.</p>\n </div>\n</body>\n</html>\n<html>\n"
StatusCodeError: 400 - "<!DOCTYPE html>\n<html>\n<head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1\" name=\"viewport\">\n <title>400 Bad Request</title>\n <style>... </style>\n</head>\n\n<body>\n <h1>\n <img src=\"...\" alt=\"GitLab Logo\" /><br />\n 400\n </h1>\n <div class=\"container\">\n <h3>Your browser sent an invalid request.</h3>\n <hr />\n <p>Please contact your GitLab administrator if you think this is a mistake.</p>\n </div>\n</body>\n</html>\n<html>\n"
at new StatusCodeError (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request-promise-core/lib/errors.js:32:15)
at /home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/request-promise-core/lib/plumbing.js:97:41
at tryCatcher (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/johnny/.vscode/extensions/gitlab.gitlab-workflow-3.13.0/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
Possible fixes
- Possibly it's lacking url-encode the branch name before sending the message