diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index 2f630e1f014d7ab06f2f22661f478b59f05a4533..f4fb96a7a7c4354cf44a7500058c7ed89dc7ecf1 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -18,7 +18,7 @@ $totalsize = 0; ?>
 		data-size="<?php p($file['size']);?>"
 		data-etag="<?php p($file['etag']);?>"
 		data-permissions="<?php p($file['permissions']); ?>">
-		<?php if($file['isPreviewAvailable']): ?>
+		<?php if(isset($file['isPreviewAvailable']) and $file['isPreviewAvailable']): ?>
 		<td class="filename svg preview-icon"
 		<?php else: ?>
 		<td class="filename svg"
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index ef4345da20e699fef432db2f46f68a64e8de5ef7..d050efd5b3202244def53407e74641f16306c9f4 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -189,8 +189,8 @@ if (isset($path)) {
 					} else {
 						$i['extension'] = '';
 					}
-					$i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($i['mimetype']);
 				}
+				$i['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($i['mimetype']);
 				$i['directory'] = $getPath;
 				$i['permissions'] = OCP\PERMISSION_READ;
 				$i['icon'] = determineIcon($i, $basePath, $token);