Fossil SCM

Truncate the name of the toplevel directory added to ZIP archives to be the first 10 characters of the UUID.

drh 2008-02-08 22:36 trunk
Commit 73a9b3d5d1539b1e98b7349bc07db89198c2b4cb
1 file changed +6 -5
+6 -5
--- src/zip.c
+++ src/zip.c
@@ -352,28 +352,29 @@
352352
** Return that ZIP archive as the HTTP reply content.
353353
*/
354354
void baseline_zip_page(void){
355355
int rid;
356356
char *zName;
357
- int i;
357
+ int nName;
358358
Blob zip;
359359
360360
login_check_credentials();
361361
if( !g.okRead || !g.okHistory ){ login_needed(); return; }
362362
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;
367367
break;
368368
}
369369
}
370370
rid = name_to_rid(zName);
371371
if( rid==0 ){
372372
@ Not found
373373
return;
374374
}
375
+ if( nName>10 ) zName[10] = 0;
375376
zip_of_baseline(rid, &zip, zName);
376377
cgi_set_content(&zip);
377378
cgi_set_content_type("application/zip");
378379
cgi_reply();
379380
}
380381
--- 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

Keyboard Shortcuts

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