diff --git a/apps/files_sharing/lib/Controller/ShareController.php b/apps/files_sharing/lib/Controller/ShareController.php
index ed9ad33417a23a2b5f0c75deda428d04609f0953..700ac22080404c028b9c511b65f57182963eda95 100644
--- a/apps/files_sharing/lib/Controller/ShareController.php
+++ b/apps/files_sharing/lib/Controller/ShareController.php
@@ -458,6 +458,10 @@ class ShareController extends Controller {
 			if ($files_list === null) {
 				$files_list = [$files];
 			}
+			// Just in case $files is a single int like '1234'
+			if (!is_array($files_list)) {
+				$files_list = [$files_list];
+			}
 		}
 
 		$userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());