Index: /trunk/DataStoreServer/web/cgi/dsgetindex
===================================================================
--- /trunk/DataStoreServer/web/cgi/dsgetindex	(revision 24174)
+++ /trunk/DataStoreServer/web/cgi/dsgetindex	(revision 24175)
@@ -62,4 +62,6 @@
     # used by the pretty printer
     @path = split(/\//, $directories);
+    # shift off the empty bit
+    shift @path;
 
 } else {
@@ -167,28 +169,30 @@
 # XXX:
 # quick hacky pretty printer
-# Stolen from Eric's Data Store mock up
-#
-
+# Adapted from Eric's Data Store mock up
+#
+
+sub print_free_space {
+    use Filesys::Df;
+	# get free space
+	my $ref = df($DS_ROOT);
+	printf '<p>Free space: %.2f G (%.1f%%)</p>',
+		$ref->{bfree}/(1024*1024),
+		100.0*$ref->{bfree}/$ref->{blocks};
+        print "\n";
+}
 sub pprint_pre {
-    #use Filesys::Df;
 
     print header('text/html', '200 OK');
     print start_html('Data Store');
 
-	# get free space
-#	my $ref = df($DS_ROOT);
-#	printf '<p>Free space: %.2fG (%.1f%%)</p>',
-#		$ref->{bfree}/(1024*1024),
-#		100.0*$ref->{bfree}/$ref->{blocks};
-#        print "\n";
 
 	# return link
         print a({-href=>"./index.txt"}, "Text Version");
 
-	if ($#path > 1) {
+	if ($#path >= 1) {
             print "&nbsp&nbsp&nbsp&nbsp\n";
 
-		my $up = join('/', @path[0..$#path-1]);
-	    print a({-href=>"$up"}, "Up to $up");
+            my $up = join('/', @path[0..$#path-1]);
+	    print a({-href=>".."}, "Up to $up");
 
 	}
@@ -204,4 +208,5 @@
     print p();
 
+    print_free_space();
     print end_html();
 }
@@ -232,10 +237,10 @@
     else {
 		# assumes id is always first field
-	    my $wpath = join('/',@path)."/$toks[0]";
-
-		# if this is a file request, use a download cgi
-		if ($wpath =~ /\.fits\s*$/) {
-			$wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
-		}
+	    my $wpath = "./$toks[0]";
+
+            # if this is a file request, use a download cgi
+            if ($wpath =~ /\.fits\s*$/) {
+                    $wpath = '/ds-cgi/dsfits.cgi?'.substr($wpath, 4); # strip' /ds/'
+            }
 
         print a({-href=>$wpath}, $toks[0]);
