Fossil SCM
Truncate the name of the toplevel directory added to ZIP archives to be the first 10 characters of the UUID.
Commit
73a9b3d5d1539b1e98b7349bc07db89198c2b4cb
Parent
4bbb00a8c892432…
1 file changed
+6
-5
+6
-5
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -352,28 +352,29 @@ | ||
| 352 | 352 | ** Return that ZIP archive as the HTTP reply content. |
| 353 | 353 | */ |
| 354 | 354 | void baseline_zip_page(void){ |
| 355 | 355 | int rid; |
| 356 | 356 | char *zName; |
| 357 | - int i; | |
| 357 | + int nName; | |
| 358 | 358 | Blob zip; |
| 359 | 359 | |
| 360 | 360 | login_check_credentials(); |
| 361 | 361 | if( !g.okRead || !g.okHistory ){ login_needed(); return; } |
| 362 | 362 | zName = mprintf("%s", PD("name","")); |
| 363 | - i = strlen(zName); | |
| 364 | - for(i=strlen(zName)-1; i>5; i--){ | |
| 365 | - if( zName[i]=='.' ){ | |
| 366 | - zName[i] = 0; | |
| 363 | + nName = strlen(zName); | |
| 364 | + for(nName=strlen(zName)-1; nName>5; nName--){ | |
| 365 | + if( zName[nName]=='.' ){ | |
| 366 | + zName[nName] = 0; | |
| 367 | 367 | break; |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | rid = name_to_rid(zName); |
| 371 | 371 | if( rid==0 ){ |
| 372 | 372 | @ Not found |
| 373 | 373 | return; |
| 374 | 374 | } |
| 375 | + if( nName>10 ) zName[10] = 0; | |
| 375 | 376 | zip_of_baseline(rid, &zip, zName); |
| 376 | 377 | cgi_set_content(&zip); |
| 377 | 378 | cgi_set_content_type("application/zip"); |
| 378 | 379 | cgi_reply(); |
| 379 | 380 | } |
| 380 | 381 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -352,28 +352,29 @@ | |
| 352 | ** Return that ZIP archive as the HTTP reply content. |
| 353 | */ |
| 354 | void baseline_zip_page(void){ |
| 355 | int rid; |
| 356 | char *zName; |
| 357 | int i; |
| 358 | Blob zip; |
| 359 | |
| 360 | login_check_credentials(); |
| 361 | if( !g.okRead || !g.okHistory ){ login_needed(); return; } |
| 362 | zName = mprintf("%s", PD("name","")); |
| 363 | i = strlen(zName); |
| 364 | for(i=strlen(zName)-1; i>5; i--){ |
| 365 | if( zName[i]=='.' ){ |
| 366 | zName[i] = 0; |
| 367 | break; |
| 368 | } |
| 369 | } |
| 370 | rid = name_to_rid(zName); |
| 371 | if( rid==0 ){ |
| 372 | @ Not found |
| 373 | return; |
| 374 | } |
| 375 | zip_of_baseline(rid, &zip, zName); |
| 376 | cgi_set_content(&zip); |
| 377 | cgi_set_content_type("application/zip"); |
| 378 | cgi_reply(); |
| 379 | } |
| 380 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -352,28 +352,29 @@ | |
| 352 | ** Return that ZIP archive as the HTTP reply content. |
| 353 | */ |
| 354 | void baseline_zip_page(void){ |
| 355 | int rid; |
| 356 | char *zName; |
| 357 | int nName; |
| 358 | Blob zip; |
| 359 | |
| 360 | login_check_credentials(); |
| 361 | if( !g.okRead || !g.okHistory ){ login_needed(); return; } |
| 362 | zName = mprintf("%s", PD("name","")); |
| 363 | nName = strlen(zName); |
| 364 | for(nName=strlen(zName)-1; nName>5; nName--){ |
| 365 | if( zName[nName]=='.' ){ |
| 366 | zName[nName] = 0; |
| 367 | break; |
| 368 | } |
| 369 | } |
| 370 | rid = name_to_rid(zName); |
| 371 | if( rid==0 ){ |
| 372 | @ Not found |
| 373 | return; |
| 374 | } |
| 375 | if( nName>10 ) zName[10] = 0; |
| 376 | zip_of_baseline(rid, &zip, zName); |
| 377 | cgi_set_content(&zip); |
| 378 | cgi_set_content_type("application/zip"); |
| 379 | cgi_reply(); |
| 380 | } |
| 381 |