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
597a3cf1
Commit
597a3cf1
authored
11 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
handle part files correctly
parent
83afba50
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
apps/files_encryption/lib/util.php
+27
-6
27 additions, 6 deletions
apps/files_encryption/lib/util.php
with
27 additions
and
6 deletions
apps/files_encryption/lib/util.php
+
27
−
6
View file @
597a3cf1
...
...
@@ -1289,8 +1289,24 @@ class Util {
*/
public
function
getUidAndFilename
(
$path
)
{
$pathinfo
=
pathinfo
(
$path
);
$partfile
=
false
;
$parentFolder
=
false
;
if
(
$pathinfo
[
'extension'
]
===
'part'
)
{
// if the real file exists we check this file
if
(
$this
->
view
->
file_exists
(
$this
->
userFilesDir
.
'/'
.
$pathinfo
[
'dirname'
]
.
'/'
.
$pathinfo
[
'filename'
]))
{
$pathToCheck
=
$pathinfo
[
'dirname'
]
.
'/'
.
$pathinfo
[
'filename'
];
}
else
{
// otherwise we look for the parent
$pathToCheck
=
$pathinfo
[
'dirname'
];
$parentFolder
=
true
;
}
$partfile
=
true
;
}
else
{
$pathToCheck
=
$path
;
}
$view
=
new
\OC\Files\View
(
$this
->
userFilesDir
);
$fileOwnerUid
=
$view
->
getOwner
(
$path
);
$fileOwnerUid
=
$view
->
getOwner
(
$path
ToCheck
);
// handle public access
if
(
$this
->
isPublic
)
{
...
...
@@ -1319,12 +1335,18 @@ class Util {
$filename
=
$path
;
}
else
{
$info
=
$view
->
getFileInfo
(
$path
);
$info
=
$view
->
getFileInfo
(
$pathToCheck
);
$ownerView
=
new
\OC\Files\View
(
'/'
.
$fileOwnerUid
.
'/files'
);
// Fetch real file path from DB
$filename
=
$ownerView
->
getPath
(
$info
[
'fileid'
]);
// TODO: Check that this returns a path without including the user data dir
$filename
=
$ownerView
->
getPath
(
$info
[
'fileid'
]);
if
(
$parentFolder
)
{
$filename
=
$filename
.
'/'
.
$pathinfo
[
'filename'
];
}
if
(
$partfile
)
{
$filename
=
$filename
.
'.'
.
$pathinfo
[
'extension'
];
}
}
...
...
@@ -1333,10 +1355,9 @@ class Util {
\OC_Filesystem
::
normalizePath
(
$filename
)
);
}
}
/**
* @brief go recursively through a dir and collect all files and sub files.
* @param string $dir relative to the users files folder
...
...
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