Differences From:
File
src/zip.c
part of check-in
[4bbb00a8c8]
- Change zip archiver to make use of blob.c mechanisms for adding prefixes
to file names. Remove C constructs that are not commonly supported.
by
drh on
2008-02-08 22:31:33.
[view]
To:
File
src/zip.c
part of check-in
[73a9b3d5d1]
- Truncate the name of the toplevel directory added to ZIP archives to be
the first 10 characters of the UUID.
by
drh on
2008-02-08 22:36:29.
[view]
@@ -353,18 +353,18 @@
*/
void baseline_zip_page(void){
int rid;
char *zName;
- int i;
+ int nName;
Blob zip;
login_check_credentials();
if( !g.okRead || !g.okHistory ){ login_needed(); return; }
zName = mprintf("%s", PD("name",""));
- i = strlen(zName);
- for(i=strlen(zName)-1; i>5; i--){
- if( zName[i]=='.' ){
- zName[i] = 0;
+ nName = strlen(zName);
+ for(nName=strlen(zName)-1; nName>5; nName--){
+ if( zName[nName]=='.' ){
+ zName[nName] = 0;
break;
}
}
rid = name_to_rid(zName);
@@ -371,9 +371,10 @@
if( rid==0 ){
@ Not found
return;
}
+ if( nName>10 ) zName[10] = 0;
zip_of_baseline(rid, &zip, zName);
cgi_set_content(&zip);
cgi_set_content_type("application/zip");
cgi_reply();
}