Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
63a878eb
Commit
63a878eb
authored
Oct 05, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check fo special char
parent
924f28c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
app.js
src/app.js
+6
-1
browser-files.js
src/app/files/browser-files.js
+4
-0
file-explorer.js
src/app/files/file-explorer.js
+5
-1
shared-folder.js
src/app/files/shared-folder.js
+4
-0
No files found.
src/app.js
View file @
63a878eb
...
...
@@ -369,7 +369,12 @@ function run () {
// Add files received from remote instance (i.e. another browser-solidity)
function
loadFiles
(
filesSet
)
{
for
(
var
f
in
filesSet
)
{
filesProviders
[
'browser'
].
set
(
helper
.
createNonClashingName
(
f
,
filesProviders
[
'browser'
]),
filesSet
[
f
].
content
)
var
name
=
helper
.
createNonClashingName
(
f
,
filesProviders
[
'browser'
])
if
(
filesProviders
[
'browser'
].
checkSpecialChars
(
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
return
}
filesProviders
[
'browser'
].
set
(
name
,
filesSet
[
f
].
content
)
}
fileManager
.
switchFile
()
}
...
...
src/app/files/browser-files.js
View file @
63a878eb
...
...
@@ -22,6 +22,10 @@ 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
...
...
src/app/files/file-explorer.js
View file @
63a878eb
...
...
@@ -137,6 +137,10 @@ function fileExplorer (appAPI, files) {
function
loadFile
()
{
var
fileReader
=
new
FileReader
()
fileReader
.
onload
=
function
(
event
)
{
if
(
files
.
checkSpecialChars
(
name
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
return
}
var
success
=
files
.
set
(
name
,
event
.
target
.
result
)
if
(
!
success
)
modalDialogCustom
.
alert
(
'Failed to create file '
+
name
)
else
events
.
trigger
(
'focus'
,
[
name
])
...
...
@@ -228,7 +232,7 @@ function fileExplorer (appAPI, files) {
if
(
label
.
innerText
===
''
)
{
modalDialogCustom
.
alert
(
'File name cannot be empty'
)
label
.
innerText
=
textUnderEdit
}
else
if
(
label
.
innerText
.
match
(
/
(\/
|:|
\*
|
\?
|"|<|>|
\\
|
\|
|'
)
/
)
!==
null
)
{
}
else
if
(
files
.
checkSpecialChars
(
label
.
innerText
)
)
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
label
.
innerText
=
textUnderEdit
}
else
if
(
!
files
.
exists
(
newPath
))
{
...
...
src/app/files/shared-folder.js
View file @
63a878eb
...
...
@@ -45,6 +45,10 @@ class SharedFolder {
cb
()
}
checkSpecialChars
(
name
)
{
return
name
.
match
(
/
(\/
|:|
\*
|
\?
|"|<|>|
\\
|
\|
|'
)
/
)
!=
null
}
init
(
cb
)
{
this
.
remixd
.
call
(
'sharedfolder'
,
'list'
,
{},
(
error
,
filesList
)
=>
{
if
(
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment