From 4ad49ea82d25105c8a383d86cc0c46e86b44c5d6 Mon Sep 17 00:00:00 2001 From: nsj Date: Tue, 29 Dec 1998 06:34:55 +0000 Subject: [PATCH] Updated to better handle malformed URLs and to toss out any blank entries that might make it into the gallery file. --- en/gallery/gengallery.pl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/en/gallery/gengallery.pl b/en/gallery/gengallery.pl index 68f226b4ce..c5a38a78dd 100755 --- a/en/gallery/gengallery.pl +++ b/en/gallery/gengallery.pl @@ -5,7 +5,7 @@ # into another SGML file where the list element pair is # already in existence. # -# Syntax: dump.pl type < galleryfile.db > galleryfile.inc +# Syntax: gengallery.pl type < galleryfile.db > galleryfile.inc # where type is one of: commerical, nonprofit, personal # # yymmdd own comments @@ -13,6 +13,9 @@ # 980311 nsj First pass # 980312 jrf Added sorting # 980313 nsj Wrapped file input routine with error checking +# 981229 nsj Tried to be more intelligent in eliminating any +# possible blank entries in the .db file and +# malformed url entries (missing http://). # Setup # Which sort program are we using? @@ -56,6 +59,15 @@ while () ($dummy, $name, $url, $description, $email, $dateadd, $datever) = m/([^\t]+)\t([^\t]+)\t([^\t]+)\t([^\t]*)\t([^\t]+)\t([^\t]+)\t([^\t]+)/; + # Skip bogus entries (in lieu of actually checking to + # eliminate them from the .db file.) + next if ($name =~ m/^$|^\s+$/); + next if ($url =~ m/^$|^\s+$|^http:\/\/\s+$/); + + # Be semi-intelligent about entries without "http://" in front + # by prepending that to any that are missing it. + $url = "http://" . $url unless ($url =~ m/^http:\/\/.*$/); + # Dump it out to the file, in SGML
  • format if ($description ne "") {