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
4151fd3e
Commit
4151fd3e
authored
11 years ago
by
Björn Schießle
Browse files
Options
Downloads
Patches
Plain Diff
try to fix unencrypted file size if it doesn't look plausible
parent
e9ce704f
Branches
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/proxy.php
+19
-2
19 additions, 2 deletions
apps/files_encryption/lib/proxy.php
with
19 additions
and
2 deletions
apps/files_encryption/lib/proxy.php
+
19
−
2
View file @
4151fd3e
...
...
@@ -316,6 +316,16 @@ class Proxy extends \OC_FileProxy {
$view
=
new
\OC_FilesystemView
(
'/'
);
$userId
=
\OCP\User
::
getUser
();
$util
=
new
Util
(
$view
,
$userId
);
// if encryption is no longer enabled or if the files aren't migrated yet
// we return the default file size
if
(
!
\OCP\App
::
isEnabled
(
'files_encryption'
)
||
$util
->
getMigrationStatus
()
!==
Util
::
MIGRATION_COMPLETED
)
{
return
$size
;
}
// if path is a folder do nothing
if
(
$view
->
is_dir
(
$path
))
{
return
$size
;
...
...
@@ -337,6 +347,15 @@ class Proxy extends \OC_FileProxy {
// if file is encrypted return real file size
if
(
is_array
(
$fileInfo
)
&&
$fileInfo
[
'encrypted'
]
===
true
)
{
// try to fix unencrypted file size if it doesn't look plausible
if
((
int
)
$fileInfo
[
'size'
]
>
0
&&
(
int
)
$fileInfo
[
'encrypted_size'
]
===
0
)
{
$fixSize
=
$util
->
getFileSize
(
$path
);
$fileInfo
[
'unencrypted_size'
]
=
$fixSize
;
// put file info if not .part file
if
(
!
Keymanager
::
isPartialFilePath
(
$relativePath
))
{
$view
->
putFileInfo
(
$path
,
$fileInfo
);
}
}
$size
=
$fileInfo
[
'unencrypted_size'
];
}
else
{
// self healing if file was removed from file cache
...
...
@@ -344,8 +363,6 @@ class Proxy extends \OC_FileProxy {
$fileInfo
=
array
();
}
$userId
=
\OCP\User
::
getUser
();
$util
=
new
Util
(
$view
,
$userId
);
$fixSize
=
$util
->
getFileSize
(
$path
);
if
(
$fixSize
>
0
)
{
$size
=
$fixSize
;
...
...
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