[Owncloud] How to read a file when encryption is on? Was: What has happened with OC_FilesystemView?

Thomas Tanghus thomas at tanghus.net
Thu Apr 26 09:58:14 UTC 2012


On Thursday 26 April 2012 03:45 Thomas Tanghus wrote:
> I couldn't figure out why my contact import stopped working, until I looked
> at the tmp files that were all binary garble.
> 
> This:
> 
>  $view = OC_App::getStorage('contacts');
>  $view->file_put_contents('/somefile.txt','some text');
> 
> produces:
> 
>  +�Α½’-ΰΑ%„ίο8Sν

D'oh... It was a bit late, so I didn't stop to think that it looked like the 
file was encrypted - and yes, I had turned encryption on just to test.

This works OK:

 $view = new OC_FilesystemView('/'.OC_User::getUser());
 if($view->file_put_contents('/somefile.txt','some text')) {
    echo $view->file_get_contents('/somefile.txt');
 }

But if I write the file in one request, and read it in another it doesn't get 
decrypted.

-- 
Med venlig hilsen / Best Regards

Thomas Tanghus



More information about the Owncloud mailing list