From af7441b808149c1a5c63a44e62a34aebd81a5c4a Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Thu, 26 Oct 2006 12:25:03 +0000
Subject: [PATCH] patch pour les zip a plat (toggg, #645)

---
 ecrire/action/joindre.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ecrire/action/joindre.php b/ecrire/action/joindre.php
index 53819bb1ab..1ec972d01a 100644
--- a/ecrire/action/joindre.php
+++ b/ecrire/action/joindre.php
@@ -145,7 +145,11 @@ function spip_action_joindre3($path, $mode, $type, $id, $id_document,$hash, $red
 // http://doc.spip.org/@spip_action_joindre5
 function spip_action_joindre5($path, $mode, $type, $id, $id_document,$hash, $redirect, &$actifs)
 {
-	return ajouter_un_document($path, basename($path), $type, $id, $mode, $id_document, $actifs);
+	$pos = strpos($path, '/zip/');
+	if (!$pos) {
+		$pos = strpos($path, '/zip_');
+	}
+	return ajouter_un_document($path, substr($path, $pos+5), $type, $id, $mode, $id_document, $actifs);
 }
 
 // Zip a deballer.
-- 
GitLab