Hello

This is a fix for the /doc url.

Currently the /doc/tip/index.wiki file is served for the /doc url but
the links are not adjusted so the file has broken links if served from
/doc

ie if you have

<a href="doc1.wiki">Topic1</a>

in index.wiki the link would not work if index.wiki is served as /doc
because there is no /doc1.wiki

This patch uses redirect instead which avoids the problem.

It also redirects /doc/ to /doc/tip/index.wiki which would return an
error previously.

The redirect is still not configurable.

Thanks

Michal
Index: src/doc.c
===================================================================
--- src/doc.c
+++ src/doc.c
@@ -308,10 +308,14 @@
     }
   }
   return "application/x-fossil-artifact";
 }
 
+static void doc_index_redirect(void){
+    db_end_transaction(0);
+    cgi_redirectf("%s%s", g.zBaseURL, "/doc/tip/index.wiki");
+}
 /*
 ** WEBPAGE: doc
 ** URL: /doc?name=BASELINE/PATH
 ** URL: /doc/BASELINE/PATH
 **
@@ -335,13 +339,16 @@
   char zBaseline[UUID_SIZE+1];      /* Baseline UUID */
   char * reason = "document not present in the repository";
 
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
-  zName = PD("name", "tip/index.wiki");
+  zName = P("name");
+  if( !zName) { return doc_index_redirect(); }
   for(i=0; zName[i] && zName[i]!='/'; i++){}
+  if( ! *zName) { return doc_index_redirect(); }
   if( zName[i]==0 || i>UUID_SIZE ){
+    reason = "invalid document specified";
     goto doc_not_found;
   }
   memcpy(zBaseline, zName, i);
   zBaseline[i] = 0;
   zName += i;

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to