From d3e15bb9bacf2947b97c48f4b97a64bf47e0a1fc Mon Sep 17 00:00:00 2001 From: busti Date: Sat, 28 Dec 2019 04:05:58 +0100 Subject: [PATCH] support unicode in search queries --- package-lock.json | 5 +++++ package.json | 2 ++ src/store/index.js | 8 +++++++- yarn.lock | 10 ++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index f0bfc82..46d5383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11156,6 +11156,11 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, "util": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", diff --git a/package.json b/package.json index 72d874d..e0fb99b 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@fortawesome/free-solid-svg-icons": "^5.11.2", "@fortawesome/vue-fontawesome": "^0.1.8", "axios": "^0.19.0", + "base-64": "^0.1.0", "bootstrap": "^4.3.1", "core-js": "^3.3.2", "dotenv-webpack": "^1.7.0", @@ -22,6 +23,7 @@ "popper.js": "^1.16.0", "ramda": "^0.26.1", "sass-loader": "^8.0.0", + "utf8": "^3.0.0", "vue": "^2.6.10", "vue-router": "^3.1.3", "vuex": "^3.1.2", diff --git a/src/store/index.js b/src/store/index.js index 440638b..13afdd2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,6 +5,9 @@ import config from '../config'; //import * as _ from 'lodash/fp'; import router from '../router'; +import * as base64 from 'base-64'; +import * as utf8 from 'utf8'; + Vue.use(Vuex); const axios = AxiosBootstrap.create({ baseURL: config.service.url, @@ -99,7 +102,10 @@ const store = new Vuex.Store({ commit('replaceLoadedItems', data); }, async searchEventItems({ commit, getters }, query) { - const {data} = await axios.get(`/1/${getters.getEventSlug}/items/${btoa(query)}`); + const foo = utf8.encode(query); + const bar = base64.encode(foo); + + const {data} = await axios.get(`/1/${getters.getEventSlug}/items/${bar}`); commit('replaceLoadedItems', data); }, async loadBoxes({ commit }) { diff --git a/yarn.lock b/yarn.lock index e8545df..e11e534 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1583,6 +1583,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= +base-64@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" + integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs= + base64-js@^1.0.2: version "1.3.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" @@ -8269,6 +8274,11 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"