Fossil SCM

/zip now ignores the .zip extension, analog to how /tar does. Minor doc improvements in /zip and /tar from the ML.

stephan 2014-07-31 21:13 trunk
Commit e0199bfc4339226e8e6170a19c48f820089f3d61
2 files changed +5 -3 +17 -7
+5 -3
--- src/tar.c
+++ src/tar.c
@@ -578,15 +578,17 @@
578578
** Generate a compressed tarball for a checkin.
579579
** Return that tarball as the HTTP reply content.
580580
**
581581
** Optional URL Parameters:
582582
**
583
-** - name=base name of the output file. Defaults to
584
-** something project/version-specific.
583
+** - name=NAME[.tar.gz] is base name of the output file. Defaults to
584
+** something project/version-specific. The prefix of the name, up to
585
+** the last '.', are used as the top-most directory name in the tar
586
+** output.
585587
**
586588
** - uuid=the version to tar (may be a tag/branch name).
587
-** Defaults to trunk.
589
+** Defaults to "trunk".
588590
**
589591
*/
590592
void tarball_page(void){
591593
int rid;
592594
char *zName, *zRid, *zKey;
593595
--- src/tar.c
+++ src/tar.c
@@ -578,15 +578,17 @@
578 ** Generate a compressed tarball for a checkin.
579 ** Return that tarball as the HTTP reply content.
580 **
581 ** Optional URL Parameters:
582 **
583 ** - name=base name of the output file. Defaults to
584 ** something project/version-specific.
 
 
585 **
586 ** - uuid=the version to tar (may be a tag/branch name).
587 ** Defaults to trunk.
588 **
589 */
590 void tarball_page(void){
591 int rid;
592 char *zName, *zRid, *zKey;
593
--- src/tar.c
+++ src/tar.c
@@ -578,15 +578,17 @@
578 ** Generate a compressed tarball for a checkin.
579 ** Return that tarball as the HTTP reply content.
580 **
581 ** Optional URL Parameters:
582 **
583 ** - name=NAME[.tar.gz] is base name of the output file. Defaults to
584 ** something project/version-specific. The prefix of the name, up to
585 ** the last '.', are used as the top-most directory name in the tar
586 ** output.
587 **
588 ** - uuid=the version to tar (may be a tag/branch name).
589 ** Defaults to "trunk".
590 **
591 */
592 void tarball_page(void){
593 int rid;
594 char *zName, *zRid, *zKey;
595
+17 -7
--- src/zip.c
+++ src/zip.c
@@ -425,15 +425,17 @@
425425
** Generate a ZIP archive for the baseline.
426426
** Return that ZIP archive as the HTTP reply content.
427427
**
428428
** Optional URL Parameters:
429429
**
430
-** - name=base name of the output file. Defaults to
431
-** something project/version-specific.
430
+** - name=NAME[.zip] is the name of the output file. Defaults to
431
+** something project/version-specific. The base part of the
432
+** name, up to the last dot, is used as the top-most directory
433
+** name in the output file.
432434
**
433435
** - uuid=the version to zip (may be a tag/branch name).
434
-** Defaults to trunk.
436
+** Defaults to "trunk".
435437
**
436438
*/
437439
void baseline_zip_page(void){
438440
int rid;
439441
char *zName, *zRid;
@@ -446,14 +448,22 @@
446448
load_control();
447449
zName = mprintf("%s", PD("name",""));
448450
nName = strlen(zName);
449451
zRid = mprintf("%s", PD("uuid","trunk"));
450452
nRid = strlen(zRid);
451
- for(nName=strlen(zName)-1; nName>5; nName--){
452
- if( zName[nName]=='.' ){
453
- zName[nName] = 0;
454
- break;
453
+ if( nName>4 && fossil_strcmp(&zName[nName-4], ".zip")==0 ){
454
+ /* Special case: Remove the ".zip" suffix. */
455
+ nName -= 4;
456
+ zName[nName] = 0;
457
+ }else{
458
+ /* If the file suffix is not ".zip" then just remove the
459
+ ** suffix up to and including the last "." */
460
+ for(nName=strlen(zName)-1; nName>5; nName--){
461
+ if( zName[nName]=='.' ){
462
+ zName[nName] = 0;
463
+ break;
464
+ }
455465
}
456466
}
457467
rid = name_to_typed_rid(nRid?zRid:zName,"ci");
458468
if( rid==0 ){
459469
@ Not found
460470
--- src/zip.c
+++ src/zip.c
@@ -425,15 +425,17 @@
425 ** Generate a ZIP archive for the baseline.
426 ** Return that ZIP archive as the HTTP reply content.
427 **
428 ** Optional URL Parameters:
429 **
430 ** - name=base name of the output file. Defaults to
431 ** something project/version-specific.
 
 
432 **
433 ** - uuid=the version to zip (may be a tag/branch name).
434 ** Defaults to trunk.
435 **
436 */
437 void baseline_zip_page(void){
438 int rid;
439 char *zName, *zRid;
@@ -446,14 +448,22 @@
446 load_control();
447 zName = mprintf("%s", PD("name",""));
448 nName = strlen(zName);
449 zRid = mprintf("%s", PD("uuid","trunk"));
450 nRid = strlen(zRid);
451 for(nName=strlen(zName)-1; nName>5; nName--){
452 if( zName[nName]=='.' ){
453 zName[nName] = 0;
454 break;
 
 
 
 
 
 
 
 
455 }
456 }
457 rid = name_to_typed_rid(nRid?zRid:zName,"ci");
458 if( rid==0 ){
459 @ Not found
460
--- src/zip.c
+++ src/zip.c
@@ -425,15 +425,17 @@
425 ** Generate a ZIP archive for the baseline.
426 ** Return that ZIP archive as the HTTP reply content.
427 **
428 ** Optional URL Parameters:
429 **
430 ** - name=NAME[.zip] is the name of the output file. Defaults to
431 ** something project/version-specific. The base part of the
432 ** name, up to the last dot, is used as the top-most directory
433 ** name in the output file.
434 **
435 ** - uuid=the version to zip (may be a tag/branch name).
436 ** Defaults to "trunk".
437 **
438 */
439 void baseline_zip_page(void){
440 int rid;
441 char *zName, *zRid;
@@ -446,14 +448,22 @@
448 load_control();
449 zName = mprintf("%s", PD("name",""));
450 nName = strlen(zName);
451 zRid = mprintf("%s", PD("uuid","trunk"));
452 nRid = strlen(zRid);
453 if( nName>4 && fossil_strcmp(&zName[nName-4], ".zip")==0 ){
454 /* Special case: Remove the ".zip" suffix. */
455 nName -= 4;
456 zName[nName] = 0;
457 }else{
458 /* If the file suffix is not ".zip" then just remove the
459 ** suffix up to and including the last "." */
460 for(nName=strlen(zName)-1; nName>5; nName--){
461 if( zName[nName]=='.' ){
462 zName[nName] = 0;
463 break;
464 }
465 }
466 }
467 rid = name_to_typed_rid(nRid?zRid:zName,"ci");
468 if( rid==0 ){
469 @ Not found
470

Keyboard Shortcuts

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