pull/1/head
yann300 7 years ago
parent 851aef0ef0
commit 90b591c3e8
  1. 2
      src/app.js
  2. 4
      src/app/files/browser-files.js
  3. 6
      src/app/files/file-explorer.js
  4. 4
      src/app/files/shared-folder.js
  5. 3
      src/app/tabs/settings-tab.js
  6. 3
      src/lib/helper.js

@ -370,7 +370,7 @@ function run () {
function loadFiles (filesSet) {
for (var f in filesSet) {
var name = helper.createNonClashingName(f, filesProviders['browser'])
if (filesProviders['browser'].checkSpecialChars(name)) {
if (helper.checkSpecialChars(name)) {
modalDialogCustom.alert('Special characters are not allowed')
return
}

@ -22,10 +22,6 @@ function Files (storage) {
cb()
}
this.checkSpecialChars = function (name) {
return name.match(/(\/|:|\*|\?|"|<|>|\\|\||')/) != null
}
this.get = function (path, cb) {
var unprefixedpath = this.removePrefix(path)
// NOTE: ignore the config file

@ -7,6 +7,8 @@ var modalDialogCustom = require('../ui/modal-dialog-custom')
var EventManager = require('ethereum-remix').lib.EventManager
var helper = require('../../lib/helper')
var remix = require('ethereum-remix')
var styleGuide = remix.ui.styleGuide
var styles = styleGuide()
@ -137,7 +139,7 @@ function fileExplorer (appAPI, files) {
function loadFile () {
var fileReader = new FileReader()
fileReader.onload = function (event) {
if (files.checkSpecialChars(name)) {
if (helper.checkSpecialChars(name)) {
modalDialogCustom.alert('Special characters are not allowed')
return
}
@ -232,7 +234,7 @@ function fileExplorer (appAPI, files) {
if (label.innerText === '') {
modalDialogCustom.alert('File name cannot be empty')
label.innerText = textUnderEdit
} else if (files.checkSpecialChars(label.innerText)) {
} else if (helper.checkSpecialChars(label.innerText)) {
modalDialogCustom.alert('Special characters are not allowed')
label.innerText = textUnderEdit
} else if (!files.exists(newPath)) {

@ -45,10 +45,6 @@ class SharedFolder {
cb()
}
checkSpecialChars (name) {
return name.match(/(\/|:|\*|\?|"|<|>|\\|\||')/) != null
}
init (cb) {
this.remixd.call('sharedfolder', 'list', {}, (error, filesList) => {
if (error) {

@ -8,6 +8,7 @@ var csjs = require('csjs-inject')
var remix = require('ethereum-remix')
var styleGuide = remix.ui.styleGuide
var styles = styleGuide()
var helper = require('../../lib/helper')
var css = csjs`
.settingsTabView {
@ -140,7 +141,7 @@ function loadVersion (version, queryParams, appAPI, el) {
url = location + 'soljson.js'
} else {
if (version.indexOf('soljson') !== 0 || version.match(/(\/|:|\*|\?|"|<|>|\\|\||')/) != null) {
if (version.indexOf('soljson') !== 0 || helper.checkSpecialChars(version)) {
console.log('loading ' + version + ' not allowed')
return
}

@ -16,5 +16,8 @@ module.exports = {
counter = (counter | 0) + 1
}
return path + counter + '.sol'
},
checkSpecialChars (name) {
return name.match(/[/:*?"<>\\'|]/) != null
}
}

Loading…
Cancel
Save