Fossil SCM
Make it easier to debug the ZIP web page. Enhance consistency between the Tarball and ZIP web pages.
Commit
b94587625384355665121001c0aebf4a01947406
Parent
a3d8b27b45173f6…
2 files changed
+1
-1
+27
-14
+1
-1
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -680,13 +680,13 @@ | ||
| 680 | 680 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 681 | 681 | |
| 682 | 682 | /* Compute a unique key for the cache entry based on query parameters */ |
| 683 | 683 | blob_init(&cacheKey, 0, 0); |
| 684 | 684 | blob_appendf(&cacheKey, "/tarball/%z", rid_to_uuid(rid)); |
| 685 | + blob_appendf(&cacheKey, "/%q", zName); | |
| 685 | 686 | if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); |
| 686 | 687 | if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); |
| 687 | - blob_appendf(&cacheKey, "/%q", zName); | |
| 688 | 688 | zKey = blob_str(&cacheKey); |
| 689 | 689 | |
| 690 | 690 | if( P("debug")!=0 ){ |
| 691 | 691 | style_header("Tarball Generator Debug Screen"); |
| 692 | 692 | @ zName = "%h(zName)"<br /> |
| 693 | 693 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -680,13 +680,13 @@ | |
| 680 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 681 | |
| 682 | /* Compute a unique key for the cache entry based on query parameters */ |
| 683 | blob_init(&cacheKey, 0, 0); |
| 684 | blob_appendf(&cacheKey, "/tarball/%z", rid_to_uuid(rid)); |
| 685 | if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); |
| 686 | if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); |
| 687 | blob_appendf(&cacheKey, "/%q", zName); |
| 688 | zKey = blob_str(&cacheKey); |
| 689 | |
| 690 | if( P("debug")!=0 ){ |
| 691 | style_header("Tarball Generator Debug Screen"); |
| 692 | @ zName = "%h(zName)"<br /> |
| 693 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -680,13 +680,13 @@ | |
| 680 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 681 | |
| 682 | /* Compute a unique key for the cache entry based on query parameters */ |
| 683 | blob_init(&cacheKey, 0, 0); |
| 684 | blob_appendf(&cacheKey, "/tarball/%z", rid_to_uuid(rid)); |
| 685 | blob_appendf(&cacheKey, "/%q", zName); |
| 686 | if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); |
| 687 | if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); |
| 688 | zKey = blob_str(&cacheKey); |
| 689 | |
| 690 | if( P("debug")!=0 ){ |
| 691 | style_header("Tarball Generator Debug Screen"); |
| 692 | @ zName = "%h(zName)"<br /> |
| 693 |
+27
-14
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -468,11 +468,10 @@ | ||
| 468 | 468 | ** |
| 469 | 469 | ** name=NAME[.zip] The base name of the output file. The default |
| 470 | 470 | ** value is a configuration parameter in the project |
| 471 | 471 | ** settings. A prefix of the name, omitting the extension, |
| 472 | 472 | ** is used as the top-most directory name. |
| 473 | - | |
| 474 | 473 | ** |
| 475 | 474 | ** uuid=TAG The check-in that is turned into a ZIP file. |
| 476 | 475 | ** Defaults to "trunk". |
| 477 | 476 | ** |
| 478 | 477 | ** in=PATTERN Only include files that match the comma-separate |
| @@ -522,10 +521,34 @@ | ||
| 522 | 521 | } |
| 523 | 522 | rid = name_to_typed_rid(nRid?zRid:zName,"ci"); |
| 524 | 523 | if( rid==0 ){ |
| 525 | 524 | @ Not found |
| 526 | 525 | return; |
| 526 | + } | |
| 527 | + if( nRid==0 && nName>10 ) zName[10] = 0; | |
| 528 | + | |
| 529 | + /* Compute a unique key for the cache entry based on query parameters */ | |
| 530 | + blob_init(&cacheKey, 0, 0); | |
| 531 | + blob_appendf(&cacheKey, "/zip/%z", rid_to_uuid(rid)); | |
| 532 | + blob_appendf(&cacheKey, "/%q", zName); | |
| 533 | + if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); | |
| 534 | + if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); | |
| 535 | + zKey = blob_str(&cacheKey); | |
| 536 | + | |
| 537 | + if( P("debug")!=0 ){ | |
| 538 | + style_header("ZIP Archive Generator Debug Screen"); | |
| 539 | + @ zName = "%h(zName)"<br /> | |
| 540 | + @ rid = %d(rid)<br /> | |
| 541 | + if( zInclude ){ | |
| 542 | + @ zInclude = "%h(zInclude)"<br /> | |
| 543 | + } | |
| 544 | + if( zExclude ){ | |
| 545 | + @ zExclude = "%h(zExclude)"<br /> | |
| 546 | + } | |
| 547 | + @ zKey = "%h(zKey)" | |
| 548 | + style_footer(); | |
| 549 | + return; | |
| 527 | 550 | } |
| 528 | 551 | if( referred_from_login() ){ |
| 529 | 552 | style_header("ZIP Archive Download"); |
| 530 | 553 | @ <form action='%R/zip/%h(zName).zip'> |
| 531 | 554 | cgi_query_parameters_to_hidden(); |
| @@ -534,28 +557,18 @@ | ||
| 534 | 557 | @ <input type="submit" value="Download" /> |
| 535 | 558 | @ </form> |
| 536 | 559 | style_footer(); |
| 537 | 560 | return; |
| 538 | 561 | } |
| 539 | - if( nRid==0 && nName>10 ) zName[10] = 0; | |
| 540 | - | |
| 541 | - /* Compute a unique key for the cache entry based on query parameters */ | |
| 542 | - blob_init(&cacheKey, 0, 0); | |
| 543 | - blob_appendf(&cacheKey, "/zip/%z", rid_to_uuid(rid)); | |
| 544 | - if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); | |
| 545 | - if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); | |
| 546 | - blob_appendf(&cacheKey, "/%q", zName); | |
| 547 | - zKey = blob_str(&cacheKey); | |
| 548 | - | |
| 549 | 562 | blob_zero(&zip); |
| 550 | 563 | if( cache_read(&zip, zKey)==0 ){ |
| 551 | 564 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 552 | 565 | cache_write(&zip, zKey); |
| 553 | 566 | } |
| 554 | - fossil_free( zName ); | |
| 555 | - fossil_free( zRid ); | |
| 556 | - blob_reset(&cacheKey); | |
| 557 | 567 | glob_free(pInclude); |
| 558 | 568 | glob_free(pExclude); |
| 569 | + fossil_free(zName); | |
| 570 | + fossil_free(zRid); | |
| 571 | + blob_reset(&cacheKey); | |
| 559 | 572 | cgi_set_content(&zip); |
| 560 | 573 | cgi_set_content_type("application/zip"); |
| 561 | 574 | } |
| 562 | 575 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -468,11 +468,10 @@ | |
| 468 | ** |
| 469 | ** name=NAME[.zip] The base name of the output file. The default |
| 470 | ** value is a configuration parameter in the project |
| 471 | ** settings. A prefix of the name, omitting the extension, |
| 472 | ** is used as the top-most directory name. |
| 473 | |
| 474 | ** |
| 475 | ** uuid=TAG The check-in that is turned into a ZIP file. |
| 476 | ** Defaults to "trunk". |
| 477 | ** |
| 478 | ** in=PATTERN Only include files that match the comma-separate |
| @@ -522,10 +521,34 @@ | |
| 522 | } |
| 523 | rid = name_to_typed_rid(nRid?zRid:zName,"ci"); |
| 524 | if( rid==0 ){ |
| 525 | @ Not found |
| 526 | return; |
| 527 | } |
| 528 | if( referred_from_login() ){ |
| 529 | style_header("ZIP Archive Download"); |
| 530 | @ <form action='%R/zip/%h(zName).zip'> |
| 531 | cgi_query_parameters_to_hidden(); |
| @@ -534,28 +557,18 @@ | |
| 534 | @ <input type="submit" value="Download" /> |
| 535 | @ </form> |
| 536 | style_footer(); |
| 537 | return; |
| 538 | } |
| 539 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 540 | |
| 541 | /* Compute a unique key for the cache entry based on query parameters */ |
| 542 | blob_init(&cacheKey, 0, 0); |
| 543 | blob_appendf(&cacheKey, "/zip/%z", rid_to_uuid(rid)); |
| 544 | if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); |
| 545 | if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); |
| 546 | blob_appendf(&cacheKey, "/%q", zName); |
| 547 | zKey = blob_str(&cacheKey); |
| 548 | |
| 549 | blob_zero(&zip); |
| 550 | if( cache_read(&zip, zKey)==0 ){ |
| 551 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 552 | cache_write(&zip, zKey); |
| 553 | } |
| 554 | fossil_free( zName ); |
| 555 | fossil_free( zRid ); |
| 556 | blob_reset(&cacheKey); |
| 557 | glob_free(pInclude); |
| 558 | glob_free(pExclude); |
| 559 | cgi_set_content(&zip); |
| 560 | cgi_set_content_type("application/zip"); |
| 561 | } |
| 562 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -468,11 +468,10 @@ | |
| 468 | ** |
| 469 | ** name=NAME[.zip] The base name of the output file. The default |
| 470 | ** value is a configuration parameter in the project |
| 471 | ** settings. A prefix of the name, omitting the extension, |
| 472 | ** is used as the top-most directory name. |
| 473 | ** |
| 474 | ** uuid=TAG The check-in that is turned into a ZIP file. |
| 475 | ** Defaults to "trunk". |
| 476 | ** |
| 477 | ** in=PATTERN Only include files that match the comma-separate |
| @@ -522,10 +521,34 @@ | |
| 521 | } |
| 522 | rid = name_to_typed_rid(nRid?zRid:zName,"ci"); |
| 523 | if( rid==0 ){ |
| 524 | @ Not found |
| 525 | return; |
| 526 | } |
| 527 | if( nRid==0 && nName>10 ) zName[10] = 0; |
| 528 | |
| 529 | /* Compute a unique key for the cache entry based on query parameters */ |
| 530 | blob_init(&cacheKey, 0, 0); |
| 531 | blob_appendf(&cacheKey, "/zip/%z", rid_to_uuid(rid)); |
| 532 | blob_appendf(&cacheKey, "/%q", zName); |
| 533 | if( zInclude ) blob_appendf(&cacheKey, ",in=%Q", zInclude); |
| 534 | if( zExclude ) blob_appendf(&cacheKey, ",ex=%Q", zExclude); |
| 535 | zKey = blob_str(&cacheKey); |
| 536 | |
| 537 | if( P("debug")!=0 ){ |
| 538 | style_header("ZIP Archive Generator Debug Screen"); |
| 539 | @ zName = "%h(zName)"<br /> |
| 540 | @ rid = %d(rid)<br /> |
| 541 | if( zInclude ){ |
| 542 | @ zInclude = "%h(zInclude)"<br /> |
| 543 | } |
| 544 | if( zExclude ){ |
| 545 | @ zExclude = "%h(zExclude)"<br /> |
| 546 | } |
| 547 | @ zKey = "%h(zKey)" |
| 548 | style_footer(); |
| 549 | return; |
| 550 | } |
| 551 | if( referred_from_login() ){ |
| 552 | style_header("ZIP Archive Download"); |
| 553 | @ <form action='%R/zip/%h(zName).zip'> |
| 554 | cgi_query_parameters_to_hidden(); |
| @@ -534,28 +557,18 @@ | |
| 557 | @ <input type="submit" value="Download" /> |
| 558 | @ </form> |
| 559 | style_footer(); |
| 560 | return; |
| 561 | } |
| 562 | blob_zero(&zip); |
| 563 | if( cache_read(&zip, zKey)==0 ){ |
| 564 | zip_of_checkin(rid, &zip, zName, pInclude, pExclude); |
| 565 | cache_write(&zip, zKey); |
| 566 | } |
| 567 | glob_free(pInclude); |
| 568 | glob_free(pExclude); |
| 569 | fossil_free(zName); |
| 570 | fossil_free(zRid); |
| 571 | blob_reset(&cacheKey); |
| 572 | cgi_set_content(&zip); |
| 573 | cgi_set_content_type("application/zip"); |
| 574 | } |
| 575 |