ShortURLs for dirs without page numbers were broken, as fname was 'index'
authorterom
Sun, 11 Nov 2007 20:39:05 +0000
changeset 9 a0a13d5e406c
parent 8 4e71e1b670bc
child 10 e8143d784b77
ShortURLs for dirs without page numbers were broken, as fname was 'index'
shorturl.cgi
--- a/shorturl.cgi	Thu Nov 08 21:25:01 2007 +0000
+++ b/shorturl.cgi	Sun Nov 11 20:39:05 2007 +0000
@@ -18,14 +18,16 @@
 try :
     type, dirpath, fname = db[key]
 
+    if type == 'img' :
+        fname += '.html'
+    elif type == 'dir' :
+        fname = ''
+
     if index :
         if index > 1 : 
-            fname += 'index_%s.html' % (index - 1)
+            fname = 'index_%s.html' % (index - 1)
 
         dirpath = '../%s' % dirpath
-    
-    if type == 'img' :
-        fname += '.html'
 
     path = os.path.join(dirpath, fname)
 finally :