server: allow user loading svg files

package: v0.49.10
This commit is contained in:
bordun 2020-03-17 17:43:11 +01:00
parent 8d7d4b989d
commit 696a71a390
2 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "0.49.9",
"version": "0.49.10",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -52,15 +52,15 @@ function httpRoute(req, res) {
url = url.replace('_:_', ':') // escaped drive colon
url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash
if (url.match(/.(jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) {
if (url.match(/.(svg|jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) {
try {
// relative resolution (session path)
// relative resolution (to session path)
var id = urlparser.parse('?' + req.headers.cookie, true).query.client_id,
sessionPath = path.dirname(ipc.clients[id].sessionPath)
res.sendFile(path.resolve(sessionPath + url))
} catch(e) {
// absolute resolution (session path)
// absolute resolution
res.sendFile(path.resolve(url))
}
} else if (url.includes('/osc-ping')) {