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
80e6ef2e
Commit
80e6ef2e
authored
Oct 05, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a reverse mapping for url / path
parent
7d6386c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
fileProvider.js
src/app/files/fileProvider.js
+8
-1
No files found.
src/app/files/fileProvider.js
View file @
80e6ef2e
...
...
@@ -17,10 +17,13 @@ class FileProvider {
addNormalizedName
(
path
,
url
)
{
this
.
providerExternalsStorage
.
set
(
this
.
type
+
'/'
+
path
,
url
)
this
.
providerExternalsStorage
.
set
(
'reverse-'
+
url
,
this
.
type
+
'/'
+
path
)
}
removeNormalizedName
(
path
)
{
const
value
=
this
.
providerExternalsStorage
.
get
(
path
)
this
.
providerExternalsStorage
.
remove
(
path
)
this
.
providerExternalsStorage
.
remove
(
'reverse-'
+
value
)
}
normalizedNameExists
(
path
)
{
...
...
@@ -31,6 +34,10 @@ class FileProvider {
return
this
.
providerExternalsStorage
.
get
(
path
)
}
getPathFromUrl
(
url
)
{
return
this
.
providerExternalsStorage
.
get
(
'reverse-'
+
url
)
}
isExternalFolder
(
path
)
{
return
this
.
externalFolders
.
includes
(
path
)
}
...
...
@@ -71,7 +78,7 @@ class FileProvider {
get
(
path
,
cb
)
{
cb
=
cb
||
function
()
{}
if
(
this
.
normalizedNameExists
(
path
))
path
=
this
.
getNormalizedName
(
path
)
// ensure we actually use the normalized path from here
path
=
this
.
getPathFromUrl
(
path
)
||
path
// ensure we actually use the normalized path from here
var
unprefixedpath
=
this
.
removePrefix
(
path
)
var
exists
=
window
.
remixFileSystem
.
existsSync
(
unprefixedpath
)
if
(
!
exists
)
return
cb
(
null
,
null
)
...
...
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