diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 8f20481db6cf3f7f61bb497e4e1420d7cec5e2b4..0233804160d20b22ffcefaa75e37a5ed11fbcc5d 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1096,7 +1096,7 @@ class Util {
 
         // handle public access
         if($fileOwnerUid === false && $this->isPublic) {
-            $filename = $this->fileIdToPath( $GLOBALS['fileSource'] );
+            $filename = $path;
             $fileOwnerUid = $GLOBALS['fileOwner'];
 
             return array ( $fileOwnerUid, $filename );
diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php
index 850985c9f9fffda12fd28b2fe739355dc4a0e21f..b8433821d3bda8dd722c82e964e29cedc2686209 100755
--- a/apps/files_encryption/tests/share.php
+++ b/apps/files_encryption/tests/share.php
@@ -428,7 +428,6 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase
         // some hacking to simulate public link
         $GLOBALS['app'] = 'files_sharing';
         $GLOBALS['fileOwner'] = 'admin';
-        $GLOBALS['fileSource'] = $fileInfo['fileid'];
         \OC_User::setUserId('');
 
         // get file contents