diff options
Diffstat (limited to 'viewer')
-rw-r--r-- | viewer/vue.config.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/viewer/vue.config.js b/viewer/vue.config.js index 614f975..55cd2e7 100644 --- a/viewer/vue.config.js +++ b/viewer/vue.config.js | |||
@@ -33,8 +33,11 @@ module.exports = { | |||
33 | before: (app, server, compiler) => { | 33 | before: (app, server, compiler) => { |
34 | app.get(`${process.env.VUE_APP_DATA_URL}*`, (req, res) => { | 34 | app.get(`${process.env.VUE_APP_DATA_URL}*`, (req, res) => { |
35 | const fs = require("fs"); | 35 | const fs = require("fs"); |
36 | const fileName = `${process.env.VUE_APP_EXAMPLE_PROJECT}${req.url.slice(process.env.VUE_APP_DATA_URL.length)}`; | 36 | const url = req.url.slice(process.env.VUE_APP_DATA_URL.length); |
37 | const file = fs.readFileSync(decodeURIComponent(fileName)); | 37 | const paramIdx = url.indexOf('?'); |
38 | const filepath = paramIdx < 0 ? url : url.substring(0, paramIdx); | ||
39 | const fullpath = `${process.env.VUE_APP_EXAMPLE_PROJECT}${decodeURIComponent(filepath)}`; | ||
40 | const file = fs.readFileSync(fullpath); | ||
38 | res.end(file); | 41 | res.end(file); |
39 | }); | 42 | }); |
40 | } | 43 | } |