From 471b26a9d553ca5c92bdf53fd60b3b0512ec520c Mon Sep 17 00:00:00 2001 From: Luis Correia Date: Fri, 3 Feb 2017 15:10:27 +0000 Subject: [PATCH] #222 - Encode branch name on requests to avoid errors with special chars --- src/backends/github/API.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backends/github/API.js b/src/backends/github/API.js index 1f0e87d4..8be0b043 100644 --- a/src/backends/github/API.js +++ b/src/backends/github/API.js @@ -331,20 +331,20 @@ export default class API { } patchRef(type, name, sha) { - return this.request(`${ this.repoURL }/git/refs/${ type }/${ name }`, { + return this.request(`${ this.repoURL }/git/refs/${ type }/${ encodeURIComponent(name) }`, { method: "PATCH", body: JSON.stringify({ sha }), }); } deleteRef(type, name, sha) { - return this.request(`${ this.repoURL }/git/refs/${ type }/${ name }`, { + return this.request(`${ this.repoURL }/git/refs/${ type }/${ encodeURIComponent(name) }`, { method: "DELETE", }); } getBranch(branch = this.branch) { - return this.request(`${ this.repoURL }/branches/${ branch }`); + return this.request(`${ this.repoURL }/branches/${ encodeURIComponent(branch) }`); } createBranch(branchName, sha) {