remote-files: server-side check for json extension
This commit is contained in:
parent
2523bbf05c
commit
bffdf8917b
2 changed files with 6 additions and 2 deletions
|
|
@ -175,7 +175,7 @@ module.exports = {
|
|||
var files = [],
|
||||
path = ''
|
||||
|
||||
var extRe = options.extension ? new RegExp('.*\\.' + options.extension) : /.*/
|
||||
var extRe = options.extension ? new RegExp('.*\\.' + options.extension + '$') : /.*/
|
||||
|
||||
if (save) {
|
||||
saveInput.addEventListener('change', ()=>{
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ module.exports = {
|
|||
|
||||
sessionSetPath: function(data, clientId) {
|
||||
|
||||
if (Array.isArray(data.path)) path = path.resolve(...data.path)
|
||||
if (Array.isArray(data.path)) data.path = path.resolve(...data.path)
|
||||
|
||||
ipc.clients[clientId].sessionPath = data.path
|
||||
|
||||
|
|
@ -175,6 +175,10 @@ module.exports = {
|
|||
|
||||
sessionSave: function(data, clientId) {
|
||||
|
||||
if (Array.isArray(data.path)) data.path = path.resolve(...data.path)
|
||||
|
||||
if (!path.basename(data.path).match(/.*\.json$/)) return console.error('Sessions must be saved as .json files')
|
||||
|
||||
module.exports.fileSave(data, clientId, true, ()=>{
|
||||
|
||||
console.log('Session file saved in '+ data.path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue