Browse Source

fix: url encode id value while appending in url path

re #725

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/743/head
Pranav C 3 years ago
parent
commit
73ff8dc90a
  1. 6
      packages/nc-gui/plugins/ncApis/restApi.js

6
packages/nc-gui/plugins/ncApis/restApi.js

@ -12,7 +12,7 @@ export default class RestApi {
} }
async read(id, params = {}) { 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 return data.data
} }
@ -67,7 +67,7 @@ export default class RestApi {
async update(id, data, oldData) { async update(id, data, oldData) {
const res = await this.$axios({ const res = await this.$axios({
method: 'put', method: 'put',
url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${id}`, url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`,
data data
}) })
const colName = Object.keys(data)[0] const colName = Object.keys(data)[0]
@ -96,7 +96,7 @@ export default class RestApi {
async delete(id) { async delete(id) {
return this.$axios({ return this.$axios({
method: 'delete', method: 'delete',
url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${id}` url: `/nc/${this.$ctx.projectId}/api/v1/${this.table}/${encodeURIComponent(id)}`
}) })
} }

Loading…
Cancel
Save