From dd95149238ae8792e2ca322d404f6ab6cb09c926 Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Sun, 15 Jul 2012 17:34:30 +0200
Subject: [PATCH] Also unlink unsuccessful imports.

---
 apps/contacts/import.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/apps/contacts/import.php b/apps/contacts/import.php
index ed1b80e132a..7d3acf86cf8 100644
--- a/apps/contacts/import.php
+++ b/apps/contacts/import.php
@@ -80,6 +80,11 @@ $imported = 0;
 $failed = 0;
 if(!count($parts) > 0) {
 	OCP\JSON::error(array('data' => array('message' => 'No contacts to import in '.$_POST['file'].'. Please check if the file is corrupted.', 'file'=>$_POST['file'])));
+	if(isset($_POST['fstype']) && $_POST['fstype'] == 'OC_FilesystemView') {
+		if(!$view->unlink('/imports/' . $_POST['file'])) {
+			OCP\Util::writeLog('contacts','Import: Error unlinking OC_FilesystemView ' . '/' . $_POST['file'], OCP\Util::ERROR);
+		}
+	}
 	exit();
 }
 foreach($parts as $part){
-- 
GitLab