Fossil SCM

Update the CGI redirect: property to work with both artifact and ticket IDs.

drh 2014-10-28 18:50 trunk
Commit 41a1b9bcfed74af395e953a6c8231b1e7fd4b2ce
1 file changed +5 -4
+5 -4
--- src/main.c
+++ src/main.c
@@ -1694,13 +1694,13 @@
16941694
/* If the CGI program contains one or more lines of the form
16951695
**
16961696
** redirect: repository-filename http://hostname/path/%s
16971697
**
16981698
** then control jumps here. Search each repository for an artifact ID
1699
-** that matches the "name" CGI parameter and for the first match,
1700
-** redirect to the corresponding URL with the "name" CGI parameter
1701
-** inserted. Paint an error page if no match is found.
1699
+** or ticket ID that matches the "name" CGI parameter and for the
1700
+** first match, redirect to the corresponding URL with the "name" CGI
1701
+** parameter inserted. Paint an error page if no match is found.
17021702
**
17031703
** If there is a line of the form:
17041704
**
17051705
** redirect: * URL
17061706
**
@@ -1721,11 +1721,12 @@
17211721
if( fossil_strcmp(azRedirect[i*2],"*")==0 ){
17221722
zNotFound = azRedirect[i*2+1];
17231723
continue;
17241724
}
17251725
db_open_repository(azRedirect[i*2]);
1726
- if( db_exists("SELECT 1 FROM blob WHERE uuid GLOB '%q*'", zName) ){
1726
+ if( db_exists("SELECT 1 FROM blob WHERE uuid GLOB '%q*'", zName) ||
1727
+ db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){
17271728
cgi_redirectf(azRedirect[i*2+1] /*works-like:"%s"*/, zName);
17281729
return;
17291730
}
17301731
db_close(1);
17311732
}
17321733
--- src/main.c
+++ src/main.c
@@ -1694,13 +1694,13 @@
1694 /* If the CGI program contains one or more lines of the form
1695 **
1696 ** redirect: repository-filename http://hostname/path/%s
1697 **
1698 ** then control jumps here. Search each repository for an artifact ID
1699 ** that matches the "name" CGI parameter and for the first match,
1700 ** redirect to the corresponding URL with the "name" CGI parameter
1701 ** inserted. Paint an error page if no match is found.
1702 **
1703 ** If there is a line of the form:
1704 **
1705 ** redirect: * URL
1706 **
@@ -1721,11 +1721,12 @@
1721 if( fossil_strcmp(azRedirect[i*2],"*")==0 ){
1722 zNotFound = azRedirect[i*2+1];
1723 continue;
1724 }
1725 db_open_repository(azRedirect[i*2]);
1726 if( db_exists("SELECT 1 FROM blob WHERE uuid GLOB '%q*'", zName) ){
 
1727 cgi_redirectf(azRedirect[i*2+1] /*works-like:"%s"*/, zName);
1728 return;
1729 }
1730 db_close(1);
1731 }
1732
--- src/main.c
+++ src/main.c
@@ -1694,13 +1694,13 @@
1694 /* If the CGI program contains one or more lines of the form
1695 **
1696 ** redirect: repository-filename http://hostname/path/%s
1697 **
1698 ** then control jumps here. Search each repository for an artifact ID
1699 ** or ticket ID that matches the "name" CGI parameter and for the
1700 ** first match, redirect to the corresponding URL with the "name" CGI
1701 ** parameter inserted. Paint an error page if no match is found.
1702 **
1703 ** If there is a line of the form:
1704 **
1705 ** redirect: * URL
1706 **
@@ -1721,11 +1721,12 @@
1721 if( fossil_strcmp(azRedirect[i*2],"*")==0 ){
1722 zNotFound = azRedirect[i*2+1];
1723 continue;
1724 }
1725 db_open_repository(azRedirect[i*2]);
1726 if( db_exists("SELECT 1 FROM blob WHERE uuid GLOB '%q*'", zName) ||
1727 db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){
1728 cgi_redirectf(azRedirect[i*2+1] /*works-like:"%s"*/, zName);
1729 return;
1730 }
1731 db_close(1);
1732 }
1733

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button