Fossil SCM
Update the CGI redirect: property to work with both artifact and ticket IDs.
Commit
41a1b9bcfed74af395e953a6c8231b1e7fd4b2ce
Parent
0a4745d3d2a7c54…
1 file changed
+5
-4
+5
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1694,13 +1694,13 @@ | ||
| 1694 | 1694 | /* If the CGI program contains one or more lines of the form |
| 1695 | 1695 | ** |
| 1696 | 1696 | ** redirect: repository-filename http://hostname/path/%s |
| 1697 | 1697 | ** |
| 1698 | 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. | |
| 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 | 1702 | ** |
| 1703 | 1703 | ** If there is a line of the form: |
| 1704 | 1704 | ** |
| 1705 | 1705 | ** redirect: * URL |
| 1706 | 1706 | ** |
| @@ -1721,11 +1721,12 @@ | ||
| 1721 | 1721 | if( fossil_strcmp(azRedirect[i*2],"*")==0 ){ |
| 1722 | 1722 | zNotFound = azRedirect[i*2+1]; |
| 1723 | 1723 | continue; |
| 1724 | 1724 | } |
| 1725 | 1725 | 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) ){ | |
| 1727 | 1728 | cgi_redirectf(azRedirect[i*2+1] /*works-like:"%s"*/, zName); |
| 1728 | 1729 | return; |
| 1729 | 1730 | } |
| 1730 | 1731 | db_close(1); |
| 1731 | 1732 | } |
| 1732 | 1733 |
| --- 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 |