diff --git a/lib/private/Repair/NC15/SetVcardDatabaseUID.php b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
index ccf6c47cbc83adad10294ffb1cc455be2b2bbef0..210fc0a862c9016386c9ef80495787f7e7cd86a1 100644
--- a/lib/private/Repair/NC15/SetVcardDatabaseUID.php
+++ b/lib/private/Repair/NC15/SetVcardDatabaseUID.php
@@ -112,7 +112,11 @@ class SetVcardDatabaseUID implements IRepairStep {
 		$count   = 0;
 		foreach ($entries as $entry) {
 			$count++;
-			$uid = $this->getUID($entry['carddata']);
+			$cardData = $entry['carddata'];
+			if (is_resource($cardData)) {
+				$cardData = stream_get_contents($cardData);
+			}
+			$uid = $this->getUID($cardData);
 			$this->update($entry['id'], $uid);
 		}
 		$this->connection->commit();