1
0
Fork 0

Fix perl pre_format_html hook wrt. binary files

When trying to view a binary file, this hook would cut it at the first
'\0'.
This commit is contained in:
Petr Baudis 2006-11-03 19:22:58 +01:00 committed by Petr Baudis
parent b8d8d27df4
commit 5af21a8d29
1 changed files with 5 additions and 5 deletions

View File

@ -135,13 +135,13 @@ do_script_hook_pre_format_html(unsigned char *url, struct cache_entry *cached,
if (SvTRUE(ERRSV)) count = 0; /* FIXME: error message ? */
SPAGAIN;
if (count == 1) {
unsigned char *new_html = POPpx;
SV *new_html_sv = POPs;
int new_html_len;
unsigned char *new_html = SvPV(new_html_sv, new_html_len);
if (new_html) {
int len = strlen(new_html);
add_fragment(cached, 0, new_html, len);
normalize_cache_entry(cached, len);
add_fragment(cached, 0, new_html, new_html_len);
normalize_cache_entry(cached, new_html_len);
}
}