File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
lib/private/files/cache/wrapper
tests/lib/files/cache/wrapper Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ protected function getSourcePath($path) {
5656 * @return null|string the jailed path or null if the path is outside the jail
5757 */
5858 protected function getJailedPath ($ path ) {
59+ if ($ this ->root === '' ) {
60+ return $ path ;
61+ }
5962 $ rootLength = strlen ($ this ->root ) + 1 ;
6063 if ($ path === $ this ->root ) {
6164 return '' ;
Original file line number Diff line number Diff line change @@ -63,8 +63,17 @@ function testClearKeepEntriesOutsideJail() {
6363 }
6464
6565 function testGetById () {
66- //not supported
67- $ this ->assertTrue (true );
66+ $ data1 = array ('size ' => 100 , 'mtime ' => 50 , 'mimetype ' => 'httpd/unix-directory ' );
67+ $ id = $ this ->sourceCache ->put ('foo/bar ' , $ data1 );
68+
69+ // path from jailed foo of foo/bar is bar
70+ $ path = $ this ->cache ->getPathById ($ id );
71+ $ this ->assertEquals ('bar ' , $ path );
72+
73+ // path from jailed '' of foo/bar is foo/bar
74+ $ this ->cache = new \OC \Files \Cache \Wrapper \CacheJail ($ this ->sourceCache , '' );
75+ $ path = $ this ->cache ->getPathById ($ id );
76+ $ this ->assertEquals ('foo/bar ' , $ path );
6877 }
6978
7079 function testGetIncomplete () {
You can’t perform that action at this time.
0 commit comments