1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

do not truncate a data: uri already shorter than 40 chars

This commit is contained in:
sgerwk 2020-09-27 19:31:14 +02:00
parent ae38be0fe0
commit 794e0078e7

View File

@ -1036,6 +1036,7 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri)
int input = 1; int input = 1;
char *replace, *original = "% "; char *replace, *original = "% ";
int truncate; int truncate;
int tlen = 40;
if (!init_string(&name)) return NULL; if (!init_string(&name)) return NULL;
@ -1078,11 +1079,12 @@ subst_file(unsigned char *prog, unsigned char *file, unsigned char *uri)
cygwin_conv_to_full_win32_path(replace, new_path); cygwin_conv_to_full_win32_path(replace, new_path);
add_to_string(&name, new_path); add_to_string(&name, new_path);
#else #else
if (! truncate) if (! truncate || strlen(replace) <= tlen)
add_shell_quoted_to_string(&name, replace, add_shell_quoted_to_string(&name,
strlen(replace)); replace, strlen(replace));
else { else {
add_shell_quoted_to_string(&name, replace, 40); add_shell_quoted_to_string(&name,
replace, tlen);
add_shell_quoted_to_string(&name, add_shell_quoted_to_string(&name,
"...", sizeof("...") - 1); "...", sizeof("...") - 1);
} }