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
bc11663d
Commit
bc11663d
authored
Feb 27, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix file normalization
parent
b3782838
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
browser-files-tree.js
src/app/files/browser-files-tree.js
+8
-5
file-explorer.js
src/app/files/file-explorer.js
+2
-1
No files found.
src/app/files/browser-files-tree.js
View file @
bc11663d
...
@@ -17,14 +17,17 @@ function FilesTree (name, storage) {
...
@@ -17,14 +17,17 @@ function FilesTree (name, storage) {
function
updateRefs
(
path
,
type
)
{
function
updateRefs
(
path
,
type
)
{
var
split
=
path
.
split
(
'/'
)
// this should be unprefixed path
var
split
=
path
.
split
(
'/'
)
// this should be unprefixed path
var
crawlpath
=
self
.
tree
var
crawlpath
=
self
.
tree
var
intermediatePath
=
''
split
.
forEach
((
pathPart
,
index
)
=>
{
split
.
forEach
((
pathPart
,
index
)
=>
{
if
(
!
crawlpath
[
pathPart
])
crawlpath
[
pathPart
]
=
{}
intermediatePath
+=
pathPart
if
(
!
crawlpath
[
pathPart
])
crawlpath
[
intermediatePath
]
=
{}
if
(
index
<
split
.
length
-
1
)
{
if
(
index
<
split
.
length
-
1
)
{
crawlpath
=
crawlpath
[
pathPart
]
crawlpath
=
crawlpath
[
intermediatePath
]
intermediatePath
+=
'/'
}
else
if
(
type
===
'add'
)
{
}
else
if
(
type
===
'add'
)
{
crawlpath
[
pathPart
]
=
path
crawlpath
[
intermediatePath
]
=
path
}
else
if
(
type
===
'remove'
&&
crawlpath
[
pathPart
])
{
}
else
if
(
type
===
'remove'
&&
crawlpath
[
intermediatePath
])
{
delete
crawlpath
[
pathPart
]
delete
crawlpath
[
intermediatePath
]
}
}
})
})
storage
.
set
(
self
.
structFile
,
JSON
.
stringify
(
self
.
tree
))
storage
.
set
(
self
.
structFile
,
JSON
.
stringify
(
self
.
tree
))
...
...
src/app/files/file-explorer.js
View file @
bc11663d
...
@@ -173,9 +173,10 @@ function fileExplorer (appAPI, files) {
...
@@ -173,9 +173,10 @@ function fileExplorer (appAPI, files) {
})
})
function
normalize
(
path
,
filesList
)
{
function
normalize
(
path
,
filesList
)
{
var
prefix
=
path
.
split
(
'/'
)[
0
]
var
newList
=
{}
var
newList
=
{}
Object
.
keys
(
filesList
).
forEach
(
key
=>
{
Object
.
keys
(
filesList
).
forEach
(
key
=>
{
newList
[
p
ath
+
'/'
+
key
]
=
filesList
[
key
].
isDirectory
?
{}
:
{
'/content'
:
true
}
newList
[
p
refix
+
'/'
+
key
]
=
filesList
[
key
].
isDirectory
?
{}
:
{
'/content'
:
true
}
})
})
return
newList
return
newList
}
}
...
...
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