1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +00:00

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'.

[ From commit 5af21a8d29 in ELinks
  0.12.GIT.  --KON ]
This commit is contained in:
Petr Baudis 2006-11-03 19:22:58 +01:00 committed by Kalle Olavi Niemitalo
parent 6aa6a71c23
commit aedb588e2b

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);
}
}