From 4aa32d9f2ab5ed8d8d1474edb6bb84ec02bc8981 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Tue, 17 Jun 2008 18:33:47 +0000
Subject: [PATCH] ne pas ecrire une copie locale d'image tronquee par
 _COPIE_LOCALE_MAX_SIZE, on ne peut rien en faire !

---
 ecrire/inc/distant.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php
index 1cd469677c..55ad049e7d 100644
--- a/ecrire/inc/distant.php
+++ b/ecrire/inc/distant.php
@@ -48,6 +48,11 @@ function copie_locale($source, $mode='auto') {
 		OR $mode=='force') {
 			$contenu = recuperer_page($source,false,false,_COPIE_LOCALE_MAX_SIZE);
 			if (!$contenu) return false;
+			if (preg_match(',[.](jpg|gif|png)$,i',$local) 
+			  AND strlen($contenu)>_COPIE_LOCALE_MAX_SIZE){
+			  spip_log ('ERREUR copie locale image '._DIR_RACINE.$local.' superieure a  '._COPIE_LOCALE_MAX_SIZE);
+			  return false;
+			}
 			ecrire_fichier(_DIR_RACINE.$local, $contenu);
 			spip_log ('ecrire copie locale '._DIR_RACINE.$local);
 			
-- 
GitLab