]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/commitdiff
add updates for -4
authorDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 16:17:41 +0000 (16:17 +0000)
committerDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 16:17:41 +0000 (16:17 +0000)
git-svn-id: file:///srv/don_svn/deb_pkgs/libapache-gallery-perl/trunk@727 8f7917da-ec0b-0410-a553-b9b0e350d17e

debian/changelog
lib/Apache/Gallery.pm
t/004_cache_dir.t

index 28eb866488f1edf0cd747bdee99fdf1a0d06d7e8..87d38050fa074cfc58cd2641fb2f8a34c4a24ac9 100644 (file)
@@ -1,3 +1,10 @@
+libapache-gallery-perl (1.0.2-4) unstable; urgency=medium
+
+  * Fix regex which prepended the wrong information to the icon path.
+    Thanks to Andreas Pakulat for reporting. (Closes: #770687)
+
+ -- Don Armstrong <don@debian.org>  Fri, 28 Nov 2014 17:10:32 -0800
+
 libapache-gallery-perl (1.0.2-3) unstable; urgency=medium
 
   * Create var/cache/www and make it writable by www-data (Closes: #710281)
index 10b4381da5085caac97bb3de76b37730a050756c..b4575bee7fed4d7d59f4fd1a8f4c744818fb339c 100644 (file)
@@ -121,10 +121,11 @@ sub handler {
        # Let Apache serve icons without us modifying the request
        if ($r->uri =~ m/^\/icons/i) {
            if ($r->uri =~ m/^\/icons\/gallery\/([^\/]+$)/i) {
-               $filename = "/usr/share/libapache-gallery-perl/icons/$filename";
-               $r->filename($filename);
-           }
-           return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+            $filename = "/usr/share/libapache-gallery-perl/icons/$1";
+            return send_file($r,$filename);
+           } else {
+            return $::MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED();
+        }
        }
        # Lookup the file in the cache and scale the image if the cached
        # image does not exist
@@ -148,32 +149,8 @@ sub handler {
                my $file = cache_dir($r, 0);
                $file =~ s/\.cache//;
 
-               my $subr = $r->lookup_file($file);
-               $r->content_type($subr->content_type());
+        return send_file($r,$file);
 
-               if ($::MP2) {
-                       my $fileinfo = stat($file);
-
-                       my $nonce = md5_base64($fileinfo->ino.$fileinfo->mtime);
-                       if ($r->headers_in->{"If-None-Match"} eq $nonce) {
-                               return Apache2::Const::HTTP_NOT_MODIFIED();
-                       }
-
-                       if ($r->headers_in->{"If-Modified-Since"} && str2time($r->headers_in->{"If-Modified-Since"}) < $fileinfo->mtime) {
-                               return Apache2::Const::HTTP_NOT_MODIFIED();
-                       }
-
-                       $r->headers_out->{"Content-Length"} = $fileinfo->size; 
-                       $r->headers_out->{"Last-Modified-Date"} = time2str($fileinfo->mtime); 
-                       $r->headers_out->{"ETag"} = $nonce;
-                       $r->sendfile($file);
-                       return Apache2::Const::OK();
-               }
-               else {
-                       $r->path_info('');
-                       $r->filename($file);
-                       return Apache::Constants::DECLINED();
-               }
                
        }
 
@@ -189,8 +166,7 @@ sub handler {
        unless ($doc_pattern) {
                $doc_pattern = '\.(mpe?g|avi|mov|asf|wmv|doc|mp3|mp4|ogg|pdf|rtf|wav|dlt|txt|html?|csv|eps)$'
        }
-       my $img_pattern = $r->dir_config('GalleryImgFile');
-       unless ($img_pattern) {
+       my $img_pattern = $r->dir_config('GalleryImgFile')      unless ($img_pattern) {
                $img_pattern = '\.(jpe?g|png|tiff?|ppm)$'
        }
 
@@ -852,6 +828,35 @@ sub handler {
 
 }
 
+sub send_file {
+    my ($r,$file) = @_;
+    my $subr = $r->lookup_file($file);
+    $r->content_type($subr->content_type());
+    if ($::MP2) {
+        my $fileinfo = stat($file);
+
+        my $nonce = md5_base64($fileinfo->ino.$fileinfo->mtime);
+        if ($r->headers_in->{"If-None-Match"} eq $nonce) {
+            return Apache2::Const::HTTP_NOT_MODIFIED();
+        }
+
+        if ($r->headers_in->{"If-Modified-Since"} && str2time($r->headers_in->{"If-Modified-Since"}) < $fileinfo->mtime) {
+            return Apache2::Const::HTTP_NOT_MODIFIED();
+        }
+
+        $r->headers_out->{"Content-Length"} = $fileinfo->size; 
+        $r->headers_out->{"Last-Modified-Date"} = time2str($fileinfo->mtime); 
+        $r->headers_out->{"ETag"} = $nonce;
+        $r->sendfile($file);
+        return Apache2::Const::OK();
+    }
+    else {
+        $r->path_info('');
+        $r->filename($file);
+        return Apache::Constants::DECLINED();
+    }
+}
+
 sub cache_dir {
 
        my ($r, $strip_filename) = @_;
@@ -1833,10 +1838,7 @@ Pattern matching the files you want Apache::Gallery to view in the index
 as normal files. All other filetypes will still be served by Apache::Gallery
 but are not visible in the index.
 
-The default is
-
-     '\.(mpe?g|avi|mov|asf|wmv|doc|mp3|mp4
-      |ogg|pdf|rtf|wav|dlt|txt|html?|csv|eps)$'
+The default is '\.(mpe?g|avi|mov|asf|wmv|doc|mp3|mp4|ogg|pdf|rtf|wav|dlt|txt|html?|csv|eps)$'
 
 =item B<GalleryTTFDir>
 
index 4998b3cb3cf2b802458ac68c5b10f5508219356d..d3dfa3beb5070b127ec6415e219d17d6c2987fb3 100644 (file)
@@ -42,12 +42,12 @@ sub request {
 }
 
 my $r=request(undef, 1);
-is(Apache::Gallery::cache_dir($r, 1), '/var/tmp/Apache-Gallery/hostname/uripath1/uripath2');
-is(Apache::Gallery::cache_dir($r, 0), '/var/tmp/Apache-Gallery/hostname/uripath1/uripath2/urifile');
+is(Apache::Gallery::cache_dir($r, 1), '/var/cache/www/hostname/uripath1/uripath2');
+is(Apache::Gallery::cache_dir($r, 0), '/var/cache/www/hostname/uripath1/uripath2/urifile');
 
 $r=request(undef, 0);
-is(Apache::Gallery::cache_dir($r, 1), '/var/tmp/Apache-Gallery/location/uripath1/uripath2');
-is(Apache::Gallery::cache_dir($r, 0), '/var/tmp/Apache-Gallery/location/uripath1/uripath2/urifile');
+is(Apache::Gallery::cache_dir($r, 1), '/var/cache/www/location/uripath1/uripath2');
+is(Apache::Gallery::cache_dir($r, 0), '/var/cache/www/location/uripath1/uripath2/urifile');
 
 $r=request('t/cachetest', 1);
 is(Apache::Gallery::cache_dir($r, 1), 't/cachetest/uripath1/uripath2');