aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_encryption/lib/stream.php11
-rw-r--r--apps/files_encryption/lib/util.php2
2 files changed, 6 insertions, 7 deletions
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 3bad43de2e0..d269a562404 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -51,7 +51,7 @@ class Stream {
// TODO: make all below properties private again once unit testing is
// configured correctly
- public $rawPath; // The raw path received by stream_open
+ public $rawPath; // The raw path relative to the data dir
public $relPath; // rel path to users file dir
private $userId;
private $handle; // Resource returned by fopen
@@ -77,12 +77,11 @@ class Stream {
}
- // Strip identifier text from path
- $this->rawPath = str_replace( 'crypt://', '', $path );
+ // Strip identifier text from path, this gives us the path relative to data/<user>/files
+ $this->relPath = str_replace( 'crypt://', '', $path );
- // Set file path relative to user files dir (7 = string length of '/files/')
- $this->relPath = substr($this->rawPath, strlen($this->userId)+7);
- //$this->relPath = $this->userId . '/files/' . $this->rawPath;
+ // rawPath is relative to the data directory
+ $this->rawPath = $this->userId . '/files/' . $this->relPath;
if (
dirname( $this->rawPath ) == 'streams'
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 4605c0f597d..6e0aeb96e96 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -344,7 +344,7 @@ class Util {
// If the file is not encrypted
} else {
- $found['plain'][] = array( 'name' => $file, 'path' => $filePath );
+ $found['plain'][] = array( 'name' => $file, 'path' => $relPath );
}