Fossil SCM
Allow symbolic names for the name= query parameter to the /rchvdwnld.
Commit
50b810013f0d865ae5d7b70611218f4d990fe58e2cd160a2ee2d950699bea2c9
Parent
ca0d66b2e4e74ea…
1 file changed
+13
-3
+13
-3
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -1290,18 +1290,25 @@ | ||
| 1290 | 1290 | |
| 1291 | 1291 | /* |
| 1292 | 1292 | ** WEBPAGE: rchvdwnld |
| 1293 | 1293 | ** |
| 1294 | 1294 | ** Short for "archive download". This page should have a single name= |
| 1295 | -** query parameter that is a check-in hash. It present a menu of possible | |
| 1296 | -** download options for that check-in, including tarball, ZIP, or SQLAR. | |
| 1295 | +** query parameter that is a check-in hash or symbolic name. The resulting | |
| 1296 | +** page offers a menu of possible download options for that check-in, | |
| 1297 | +** including tarball, ZIP, or SQLAR. | |
| 1297 | 1298 | ** |
| 1298 | 1299 | ** This is a utility page. The /dir and /tree pages sometimes have a |
| 1299 | 1300 | ** "Download" option in their submenu which redirects here. Those pages |
| 1300 | 1301 | ** used to have separate "Tarball" and "ZIP" submenu entries, but as |
| 1301 | 1302 | ** submenu entries appear in alphabetical order, that caused the two |
| 1302 | 1303 | ** submenu entries to be separated from one another, which is distracting. |
| 1304 | +** | |
| 1305 | +** If the name= does not have a unique resolution, no error is generated. | |
| 1306 | +** Instead, a redirect to the home page for the repository is made. | |
| 1307 | +** | |
| 1308 | +** Robots are excluded from this page if either of the keywords | |
| 1309 | +** "zip" or "download" appear in the [[robot-restrict]] setting. | |
| 1303 | 1310 | */ |
| 1304 | 1311 | void rchvdwnld_page(void){ |
| 1305 | 1312 | const char *zUuid; |
| 1306 | 1313 | char *zBase; |
| 1307 | 1314 | int nUuid; |
| @@ -1315,11 +1322,14 @@ | ||
| 1315 | 1322 | || (nUuid = (int)strlen(zUuid))<6 |
| 1316 | 1323 | || !validate16(zUuid,-1) |
| 1317 | 1324 | || (rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUuid))==0 |
| 1318 | 1325 | || !db_exists("SELECT 1 from event WHERE type='ci' AND objid=%d",rid) |
| 1319 | 1326 | ){ |
| 1320 | - fossil_redirect_home(); | |
| 1327 | + rid = symbolic_name_to_rid(zUuid, "ci"); | |
| 1328 | + if( rid<=0 ){ | |
| 1329 | + fossil_redirect_home(); | |
| 1330 | + } | |
| 1321 | 1331 | } |
| 1322 | 1332 | zUuid = db_text(zUuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1323 | 1333 | style_header("Downloads For Check-in %!S", zUuid); |
| 1324 | 1334 | zBase = archive_base_name(rid); |
| 1325 | 1335 | @ <div class="section accordion">Downloads for check-in \ |
| 1326 | 1336 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -1290,18 +1290,25 @@ | |
| 1290 | |
| 1291 | /* |
| 1292 | ** WEBPAGE: rchvdwnld |
| 1293 | ** |
| 1294 | ** Short for "archive download". This page should have a single name= |
| 1295 | ** query parameter that is a check-in hash. It present a menu of possible |
| 1296 | ** download options for that check-in, including tarball, ZIP, or SQLAR. |
| 1297 | ** |
| 1298 | ** This is a utility page. The /dir and /tree pages sometimes have a |
| 1299 | ** "Download" option in their submenu which redirects here. Those pages |
| 1300 | ** used to have separate "Tarball" and "ZIP" submenu entries, but as |
| 1301 | ** submenu entries appear in alphabetical order, that caused the two |
| 1302 | ** submenu entries to be separated from one another, which is distracting. |
| 1303 | */ |
| 1304 | void rchvdwnld_page(void){ |
| 1305 | const char *zUuid; |
| 1306 | char *zBase; |
| 1307 | int nUuid; |
| @@ -1315,11 +1322,14 @@ | |
| 1315 | || (nUuid = (int)strlen(zUuid))<6 |
| 1316 | || !validate16(zUuid,-1) |
| 1317 | || (rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUuid))==0 |
| 1318 | || !db_exists("SELECT 1 from event WHERE type='ci' AND objid=%d",rid) |
| 1319 | ){ |
| 1320 | fossil_redirect_home(); |
| 1321 | } |
| 1322 | zUuid = db_text(zUuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1323 | style_header("Downloads For Check-in %!S", zUuid); |
| 1324 | zBase = archive_base_name(rid); |
| 1325 | @ <div class="section accordion">Downloads for check-in \ |
| 1326 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -1290,18 +1290,25 @@ | |
| 1290 | |
| 1291 | /* |
| 1292 | ** WEBPAGE: rchvdwnld |
| 1293 | ** |
| 1294 | ** Short for "archive download". This page should have a single name= |
| 1295 | ** query parameter that is a check-in hash or symbolic name. The resulting |
| 1296 | ** page offers a menu of possible download options for that check-in, |
| 1297 | ** including tarball, ZIP, or SQLAR. |
| 1298 | ** |
| 1299 | ** This is a utility page. The /dir and /tree pages sometimes have a |
| 1300 | ** "Download" option in their submenu which redirects here. Those pages |
| 1301 | ** used to have separate "Tarball" and "ZIP" submenu entries, but as |
| 1302 | ** submenu entries appear in alphabetical order, that caused the two |
| 1303 | ** submenu entries to be separated from one another, which is distracting. |
| 1304 | ** |
| 1305 | ** If the name= does not have a unique resolution, no error is generated. |
| 1306 | ** Instead, a redirect to the home page for the repository is made. |
| 1307 | ** |
| 1308 | ** Robots are excluded from this page if either of the keywords |
| 1309 | ** "zip" or "download" appear in the [[robot-restrict]] setting. |
| 1310 | */ |
| 1311 | void rchvdwnld_page(void){ |
| 1312 | const char *zUuid; |
| 1313 | char *zBase; |
| 1314 | int nUuid; |
| @@ -1315,11 +1322,14 @@ | |
| 1322 | || (nUuid = (int)strlen(zUuid))<6 |
| 1323 | || !validate16(zUuid,-1) |
| 1324 | || (rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUuid))==0 |
| 1325 | || !db_exists("SELECT 1 from event WHERE type='ci' AND objid=%d",rid) |
| 1326 | ){ |
| 1327 | rid = symbolic_name_to_rid(zUuid, "ci"); |
| 1328 | if( rid<=0 ){ |
| 1329 | fossil_redirect_home(); |
| 1330 | } |
| 1331 | } |
| 1332 | zUuid = db_text(zUuid, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 1333 | style_header("Downloads For Check-in %!S", zUuid); |
| 1334 | zBase = archive_base_name(rid); |
| 1335 | @ <div class="section accordion">Downloads for check-in \ |
| 1336 |