Fossil SCM
/zip now ignores the .zip extension, analog to how /tar does. Minor doc improvements in /zip and /tar from the ML.
Commit
e0199bfc4339226e8e6170a19c48f820089f3d61
Parent
8ab520c5896c8ff…
2 files changed
+5
-3
+17
-7
+5
-3
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -578,15 +578,17 @@ | ||
| 578 | 578 | ** Generate a compressed tarball for a checkin. |
| 579 | 579 | ** Return that tarball as the HTTP reply content. |
| 580 | 580 | ** |
| 581 | 581 | ** Optional URL Parameters: |
| 582 | 582 | ** |
| 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. | |
| 585 | 587 | ** |
| 586 | 588 | ** - uuid=the version to tar (may be a tag/branch name). |
| 587 | -** Defaults to trunk. | |
| 589 | +** Defaults to "trunk". | |
| 588 | 590 | ** |
| 589 | 591 | */ |
| 590 | 592 | void tarball_page(void){ |
| 591 | 593 | int rid; |
| 592 | 594 | char *zName, *zRid, *zKey; |
| 593 | 595 |
| --- 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 @@ | ||
| 425 | 425 | ** Generate a ZIP archive for the baseline. |
| 426 | 426 | ** Return that ZIP archive as the HTTP reply content. |
| 427 | 427 | ** |
| 428 | 428 | ** Optional URL Parameters: |
| 429 | 429 | ** |
| 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. | |
| 432 | 434 | ** |
| 433 | 435 | ** - uuid=the version to zip (may be a tag/branch name). |
| 434 | -** Defaults to trunk. | |
| 436 | +** Defaults to "trunk". | |
| 435 | 437 | ** |
| 436 | 438 | */ |
| 437 | 439 | void baseline_zip_page(void){ |
| 438 | 440 | int rid; |
| 439 | 441 | char *zName, *zRid; |
| @@ -446,14 +448,22 @@ | ||
| 446 | 448 | load_control(); |
| 447 | 449 | zName = mprintf("%s", PD("name","")); |
| 448 | 450 | nName = strlen(zName); |
| 449 | 451 | zRid = mprintf("%s", PD("uuid","trunk")); |
| 450 | 452 | 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 | + } | |
| 455 | 465 | } |
| 456 | 466 | } |
| 457 | 467 | rid = name_to_typed_rid(nRid?zRid:zName,"ci"); |
| 458 | 468 | if( rid==0 ){ |
| 459 | 469 | @ Not found |
| 460 | 470 |
| --- 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 |