tags 619625 + upstream
tags 619625 + patch
thanks

Hi there!

On Fri, 25 Mar 2011 18:32:34 +0100, Luca Capello wrote:
> I X-Debbugs-Cc:ed Apache::Gallery author, given that the user mailing
> lists does not work anymore <http://apachegallery.dk/?p=mailinglists>.

Now Cc:ed ;-)

> For that, it would be good to "blacklist" them simply creating a
> <directory|file>.ignore file.  I will attach a working patch as soon as
> this bug gets a number.

Attached, tested on a squeeze box.

Thx, bye,
Gismo / Luca

diff -Naur -x README.NEW Apache-Gallery-1.0.1_Debian-337012-2/Changes Apache-Gallery-1.0.1/Changes
--- Apache-Gallery-1.0.1_Debian-337012-2/Changes	2011-03-25 00:06:34.496197246 +0100
+++ Apache-Gallery-1.0.1/Changes	2011-03-25 18:41:36.107224582 +0100
@@ -3,7 +3,7 @@
 
 Revision history for Perl extension Apache::Gallery.
 
-1.0.2~1 Fri Mar 25 00:01:48 CET 2011
+1.0.2~1 Fri Mar 25 18:41:35 CET 2011
 
 	- Fixed counter typo for <directory>.folder in next directory
 	  menu item.  (Luca Capello)
@@ -18,6 +18,8 @@
 	  allowed it.  (Luca Capello)
 	- Added text-html.png and text-txt.png icons.
 	  (Debian bug #423004, Luca Capello)
+	- Added support to ignore items through <directory|file>.ignore.
+	  (Debian bug #619625, Luca Capello)
 
 1.0.1 Wed Feb 23 20:45:38 CET 2011
 
diff -Naur -x README.NEW Apache-Gallery-1.0.1_Debian-337012-2/lib/Apache/Gallery.pm Apache-Gallery-1.0.1/lib/Apache/Gallery.pm
--- Apache-Gallery-1.0.1_Debian-337012-2/lib/Apache/Gallery.pm	2011-03-25 00:06:34.500197326 +0100
+++ Apache-Gallery-1.0.1/lib/Apache/Gallery.pm	2011-03-25 18:39:37.547202128 +0100
@@ -351,7 +351,8 @@
 
 				my $fileurl = $uri."/".$file;
 
-				if (-d $thumbfilename) {
+				# Debian bug #619625 <http://bugs.debian.org/619625>
+				if (-d $thumbfilename && ! -e $thumbfilename . ".ignore") {
 					my $dirtitle = '';
 					if (-e $thumbfilename . ".folder") {
 						$dirtitle = get_filecontent($thumbfilename . ".folder");
@@ -367,7 +368,8 @@
 									   );
 
 				}
-				elsif (-f $thumbfilename && $thumbfilename =~ /$doc_pattern/i && $thumbfilename !~ /$img_pattern/i) {
+				# Debian bug #619625 <http://bugs.debian.org/619625>
+				elsif (-f $thumbfilename && $thumbfilename =~ /$doc_pattern/i && $thumbfilename !~ /$img_pattern/i && ! -e $thumbfilename . ".ignore") {
 					my $type = lc($1);
 					my $stat = stat($thumbfilename);
 					my $size = $stat->size;
@@ -405,7 +407,8 @@
 									       }
 								      );
 				}
-				elsif (-f $thumbfilename) {
+				# Debian bug #619625 <http://bugs.debian.org/619625>
+				elsif (-f $thumbfilename && ! -e $thumbfilename . ".ignore") {
 
 					my ($width, $height, $type) = imgsize($thumbfilename);
 					next if $type eq 'Data stream is not a known image file format';
@@ -474,7 +477,8 @@
 				return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
 			}
 	
-			my @neighbour_directories = grep { !/^\./ && -d "$parent_filename/$_" } readdir (PARENT_DIR);
+			# Debian bug #619625 <http://bugs.debian.org/619625>
+			my @neighbour_directories = grep { !/^\./ && -d "$parent_filename/$_" && ! -e "$parent_filename/$_" . ".ignore" } readdir (PARENT_DIR);
 			my $dirsortby;
 			if (defined($r->dir_config('GalleryDirSortBy'))) {
 				$dirsortby=$r->dir_config('GalleryDirSortBy');
@@ -626,7 +630,7 @@
 			show_error($r, 500, "Unable to access directory", "Unable to access directory $path");
 			return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
 		}
-		my @pictures = grep { /$img_pattern/i } readdir (DATADIR);
+		my @pictures = grep { /$img_pattern/i && ! -e "$path/$_" . ".ignore" } readdir (DATADIR);
 		closedir(DATADIR);
 		@pictures = gallerysort($r, @pictures);
 
@@ -1974,6 +1978,11 @@
 create a file in the same directory called "Picture1234.jpg.rotate" with
 the number 1 inside of it.
 
+=item B<Ignore directories/files>
+
+To ignore a directory or a file (of any kind, not only images) you
+create a <directory|file>.ignore file.
+
 =item B<Comments>
 
 To include comments for a directory you create a <directory>.comment
diff -Naur -x README.NEW Apache-Gallery-1.0.1_Debian-337012-2/README Apache-Gallery-1.0.1/README
--- Apache-Gallery-1.0.1_Debian-337012-2/README	2011-03-25 00:06:34.500197326 +0100
+++ Apache-Gallery-1.0.1/README	2011-03-25 18:34:43.797153022 +0100
@@ -268,6 +268,10 @@
         would create a file in the same directory called
         "Picture1234.jpg.rotate" with the number 1 inside of it.
 
+    Ignore directories/files
+        To ignore a directory or a file (of any kind, not only images) you
+        create a <directory|file>.ignore file.
+
     Comments
         To include comments for a directory you create a <directory>.comment
         file where the first line can contain "TITLE: New title" which will

Attachment: pgpIcuZlG36FW.pgp
Description: PGP signature

Reply via email to