Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
40739350
Commit
40739350
authored
12 years ago
by
Thomas Müller
Browse files
Options
Downloads
Patches
Plain Diff
class Mapper no respects an unchanged physical root which will be excluded from slugifying the path
parent
b488800b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/files/mapper.php
+12
-12
12 additions, 12 deletions
lib/files/mapper.php
with
12 additions
and
12 deletions
lib/files/mapper.php
+
12
−
12
View file @
40739350
...
...
@@ -7,6 +7,12 @@ namespace OC\Files;
*/
class
Mapper
{
private
$unchangedPhysicalRoot
;
public
function
__construct
(
$rootDir
)
{
$this
->
unchangedPhysicalRoot
=
$rootDir
;
}
/**
* @param string $logicPath
* @param bool $create indicates if the generated physical name shall be stored in the database or not
...
...
@@ -23,7 +29,7 @@ class Mapper
/**
* @param string $physicalPath
* @return string
|null
* @return string
*/
public
function
physicalToLogic
(
$physicalPath
)
{
$logicPath
=
$this
->
resolvePhysicalPath
(
$physicalPath
);
...
...
@@ -39,6 +45,7 @@ class Mapper
* @param string $path
* @param bool $isLogicPath indicates if $path is logical or physical
* @param $recursive
* @return void
*/
public
function
removePath
(
$path
,
$isLogicPath
,
$recursive
)
{
if
(
$recursive
)
{
...
...
@@ -159,14 +166,11 @@ class Mapper
}
private
function
slugifyPath
(
$path
,
$index
=
null
)
{
$path
=
$this
->
stripRootFolder
(
$path
,
$this
->
unchangedPhysicalRoot
);
$pathElements
=
explode
(
'/'
,
$path
);
$sluggedElements
=
array
();
// skip slugging the drive letter on windows - TODO: test if local path
if
(
\OC_Util
::
runningOnWindows
())
{
$sluggedElements
[]
=
$pathElements
[
0
];
array_shift
(
$pathElements
);
}
foreach
(
$pathElements
as
$pathElement
)
{
// remove empty elements
if
(
empty
(
$pathElement
))
{
...
...
@@ -186,12 +190,8 @@ class Mapper
array_push
(
$sluggedElements
,
$last
.
'-'
.
$index
);
}
// on non-windows systems add the leading / if necessary
if
(
!
\OC_Util
::
runningOnWindows
()
and
$path
[
0
]
===
'/'
)
{
return
DIRECTORY_SEPARATOR
.
implode
(
DIRECTORY_SEPARATOR
,
$sluggedElements
);
}
return
implode
(
DIRECTORY_SEPARATOR
,
$sluggedElements
);
$sluggedPath
=
$this
->
unchangedPhysicalRoot
.
implode
(
DIRECTORY_SEPARATOR
,
$sluggedElements
);
return
$this
->
stripLast
(
$sluggedPath
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment