From 73ff8dc90ac910bf5cf8578bd173b66ccff99d3c Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 1 Nov 2021 15:17:17 +0530 Subject: [PATCH] fix: url encode id value while appending in url path re #725 Signed-off-by: Pranav C --- packages/nc-gui/plugins/ncApis/restApi.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/plugins/ncApis/restApi.js b/packages/nc-gui/plugins/ncApis/restApi.js index 262ecd285a..722a3e0749 100644 --- a/packages/nc-gui/plugins/ncApis/restApi.js +++ b/packages/nc-gui/plugins/ncApis/restApi.js @@ -12,7 +12,7 @@ export default class RestApi { } async read(id, params = {}) { - const data = await this.get(`/nc/${this.$ctx.projectId}/api/v1/${this.table}/${id}`, params) + const data = await this.get(`/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`, params) return data.data } @@ -67,7 +67,7 @@ export default class RestApi { async update(id, data, oldData) { const res = await this.$axios({ method: 'put', - url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${id}`, + url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`, data }) const colName = Object.keys(data)[0] @@ -96,7 +96,7 @@ export default class RestApi { async delete(id) { return this.$axios({ method: 'delete', - url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${id}` + url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}` }) }