Fossil SCM

Allow symbolic names for the name= query parameter to the /rchvdwnld.

drh 2025-10-31 13:29 trunk
Commit 50b810013f0d865ae5d7b70611218f4d990fe58e2cd160a2ee2d950699bea2c9
1 file changed +13 -3
+13 -3
--- src/tar.c
+++ src/tar.c
@@ -1290,18 +1290,25 @@
12901290
12911291
/*
12921292
** WEBPAGE: rchvdwnld
12931293
**
12941294
** 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.
12971298
**
12981299
** This is a utility page. The /dir and /tree pages sometimes have a
12991300
** "Download" option in their submenu which redirects here. Those pages
13001301
** used to have separate "Tarball" and "ZIP" submenu entries, but as
13011302
** submenu entries appear in alphabetical order, that caused the two
13021303
** 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.
13031310
*/
13041311
void rchvdwnld_page(void){
13051312
const char *zUuid;
13061313
char *zBase;
13071314
int nUuid;
@@ -1315,11 +1322,14 @@
13151322
|| (nUuid = (int)strlen(zUuid))<6
13161323
|| !validate16(zUuid,-1)
13171324
|| (rid = db_int(0, "SELECT rid FROM blob WHERE uuid GLOB '%q*'", zUuid))==0
13181325
|| !db_exists("SELECT 1 from event WHERE type='ci' AND objid=%d",rid)
13191326
){
1320
- fossil_redirect_home();
1327
+ rid = symbolic_name_to_rid(zUuid, "ci");
1328
+ if( rid<=0 ){
1329
+ fossil_redirect_home();
1330
+ }
13211331
}
13221332
zUuid = db_text(zUuid, "SELECT uuid FROM blob WHERE rid=%d", rid);
13231333
style_header("Downloads For Check-in %!S", zUuid);
13241334
zBase = archive_base_name(rid);
13251335
@ <div class="section accordion">Downloads for check-in \
13261336
--- 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

Keyboard Shortcuts

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