Southclaws/pawn-redis

Redis + Requests

4kamaz opened this issue · 2 comments

Hi, we use pawn-requests (v 0.6.2) and pawn-redis (v 1.0.4), but finally we face a problem which consists that we receive not that result which we expect.

Code (double '):

    new message_test[512];
    new stringfy[512];
	new Node:node = JsonObject(
	    "key", JsonString("value"),
	    "keynew", JsonString("My Value")
	);
	JsonStringify(node, stringfy);
    format(message_test, 512, "LPUSH logs-1 '%s'", stringfy);
    Redis_Command(Redis:client_exists, message_test);

Result:
image

Code (double "):

    new message_test[512];
    new stringfy[512];
	new Node:node = JsonObject(
	    "key", JsonString("value"),
	    "keynew", JsonString("My Value")
	);
	JsonStringify(node, stringfy);
    format(message_test, 512, "LPUSH logs-1 \"%s\"", stringfy);
    Redis_Command(Redis:client_exists, message_test);

Result:
image

The quick fix to this would be to escape all quote marks.

I think the long term solution for this would be to implement native list support to the plugin.

There's a function to perform quote escapes here:

https://github.com/Southclaws/samp-logger/blob/master/logger.inc#L209-L219

thanks