diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php
index 7d040689d41915b914f0a9c5b1201341078b3cf3..ca95a68c6ce940f0277c383cabd99eeafe20c477 100644
--- a/apps/files_sharing/get.php
+++ b/apps/files_sharing/get.php
@@ -30,8 +30,9 @@ if ($source !== false) {
 		foreach (OC_Files::getdirectorycontent($source) as $i) {
 			$i['date'] = OC_Util::formatDate($i['mtime'] );
 			if ($i['type'] == 'file') {
-				$i['extention'] = substr($i['name'], strrpos($i['name'], "."));
-				$i['basename'] = substr($i['name'], 0, strrpos($i['name'], "."));
+				$fileinfo = pathinfo($i['name']);
+				$i['basename'] = $fileinfo['filename'];
+				$i['extention'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : '';
 			}
 			$i['directory'] = substr($i['directory'], $rootLength);
 			if ($i['directory'] == "/") {