* 
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*  
* You should have received a copy of the GNU Affero General Public 
* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
* 
*/
OCP\JSON::checkAppEnabled('conversations');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$path = isset($_POST['path']) ? $_POST['path'] : false;
if ($path) {
    $room = OC_Conversations::getRoom();
    $userId = OC_User::getUser();
    \OC_Util::setupFS($userId);
    \OC\Files\Filesystem::initMountPoints($userId);
    $view = new \OC\Files\View('/' . $userId . '/files');
    $fileinfo = $view->getFileInfo($path);
    $owner = $view->getOwner($path);
    if (strpos($fileinfo['mimetype'], "image") !== false) {
        $type = 'internal_image';
    } else {
        $type = 'internal_file';
    }
    $download_url = OCP\Util::linkToRoute('download', array('file' => $path));
    // File not found
    if (\OC\Files\Filesystem::is_file($path) == false) {
        $fileinfo['name'] = "File not found.";