mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-09 05:33:58 -04:00
selection: uri decode: move zero-length check into decode_one_uri()
This commit is contained in:
parent
21053f2c6b
commit
bd49260e41
1 changed files with 4 additions and 2 deletions
|
|
@ -1213,6 +1213,9 @@ decode_one_uri(struct clipboard_receive *ctx, char *uri, size_t len)
|
||||||
{
|
{
|
||||||
LOG_DBG("URI: \"%.*s\"", (int)len, uri);
|
LOG_DBG("URI: \"%.*s\"", (int)len, uri);
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
char *scheme, *host, *path;
|
char *scheme, *host, *path;
|
||||||
if (!uri_parse(uri, len, &scheme, NULL, NULL, &host, NULL, &path, NULL, NULL)) {
|
if (!uri_parse(uri, len, &scheme, NULL, NULL, &host, NULL, &path, NULL, NULL)) {
|
||||||
LOG_ERR("drag-and-drop: invalid URI: %.*s", (int)len, uri);
|
LOG_ERR("drag-and-drop: invalid URI: %.*s", (int)len, uri);
|
||||||
|
|
@ -1267,8 +1270,7 @@ static void
|
||||||
fdm_receive_finish_uri(struct clipboard_receive *ctx)
|
fdm_receive_finish_uri(struct clipboard_receive *ctx)
|
||||||
{
|
{
|
||||||
LOG_DBG("finish: %.*s", (int)ctx->buf.idx, ctx->buf.data);
|
LOG_DBG("finish: %.*s", (int)ctx->buf.idx, ctx->buf.data);
|
||||||
if (ctx->buf.idx > 0)
|
decode_one_uri(ctx, ctx->buf.data, ctx->buf.idx);
|
||||||
decode_one_uri(ctx, ctx->buf.data, ctx->buf.idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue