mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Follow-up for commit fdacffd113
: change
the Python, Ruby, and SEE hooks for pre-format-html to work properly now that they are given a non-NUL-terminated string. Thanks to fonseca for noticing this problem as well as that fixed by the previous commit.
This commit is contained in:
parent
97b71aa868
commit
5145ae266a
@ -107,8 +107,9 @@ do_script_hook_pre_format_html(unsigned char *url, struct cache_entry *cached,
|
|||||||
PyObject *pFunc = PyDict_GetItemString(pDict, "pre_format_html_hook");
|
PyObject *pFunc = PyDict_GetItemString(pDict, "pre_format_html_hook");
|
||||||
|
|
||||||
if (pFunc && PyCallable_Check(pFunc)) {
|
if (pFunc && PyCallable_Check(pFunc)) {
|
||||||
PyObject *pValue = PyObject_CallFunction(pFunc, "ss", url,
|
PyObject *pValue = PyObject_CallFunction(pFunc, "ss#", url,
|
||||||
fragment->data);
|
fragment->data,
|
||||||
|
fragment->length);
|
||||||
|
|
||||||
if (pValue && (pValue != Py_None)) {
|
if (pValue && (pValue != Py_None)) {
|
||||||
const unsigned char *str = PyString_AsString(pValue);
|
const unsigned char *str = PyString_AsString(pValue);
|
||||||
|
@ -160,7 +160,7 @@ script_hook_pre_format_html(va_list ap, void *data)
|
|||||||
|
|
||||||
args[0] = rb_str_new2(url);
|
args[0] = rb_str_new2(url);
|
||||||
/* FIXME: Use html_len */
|
/* FIXME: Use html_len */
|
||||||
args[1] = rb_str_new2(fragment->data);
|
args[1] = rb_str_new(fragment->data, fragment->length);
|
||||||
|
|
||||||
result = erb_protected_method_call("pre_format_html_hook", 2, args, &error);
|
result = erb_protected_method_call("pre_format_html_hook", 2, args, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -171,7 +171,8 @@ script_hook_pre_format_html(va_list ap, void *data)
|
|||||||
return EVENT_HOOK_STATUS_NEXT;
|
return EVENT_HOOK_STATUS_NEXT;
|
||||||
|
|
||||||
SEE_SET_STRING(args[0], SEE_string_sprintf(see, "%s", url));
|
SEE_SET_STRING(args[0], SEE_string_sprintf(see, "%s", url));
|
||||||
SEE_SET_STRING(args[1], SEE_string_sprintf(see, "%s", fragment->data));
|
SEE_SET_STRING(args[1], SEE_string_sprintf(see, "%.*s", fragment->data,
|
||||||
|
fragment->length));
|
||||||
|
|
||||||
if (!call_see_hook(see, ses, "pre_format_html", args, sizeof_array(args), &result))
|
if (!call_see_hook(see, ses, "pre_format_html", args, sizeof_array(args), &result))
|
||||||
return EVENT_HOOK_STATUS_NEXT;
|
return EVENT_HOOK_STATUS_NEXT;
|
||||||
|
Loading…
Reference in New Issue
Block a user