mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
uri: skip query/fragment parsing when dealing with file:// URIs
Also, ignore invalid query/fragments (i.e. if the fragment comes before the query). Closes #1840
This commit is contained in:
parent
996e5fa630
commit
d68da27a7f
2 changed files with 19 additions and 0 deletions
|
|
@ -85,9 +85,13 @@
|
||||||
* The `.desktop` files no longer use the reverse DNS naming scheme,
|
* The `.desktop` files no longer use the reverse DNS naming scheme,
|
||||||
and their names now match the default app-ids used by foot (`foot`
|
and their names now match the default app-ids used by foot (`foot`
|
||||||
and `footclient`) ([#1607][1607]).
|
and `footclient`) ([#1607][1607]).
|
||||||
|
* `file://` prefix are now stripped from OSC-8 URIs when
|
||||||
|
activated/opened, **if** the hostname matches the hostname of the
|
||||||
|
computer foot is running on ([#1840][1840]).
|
||||||
|
|
||||||
[1822]: https://codeberg.org/dnkl/foot/issues/1822
|
[1822]: https://codeberg.org/dnkl/foot/issues/1822
|
||||||
[1607]: https://codeberg.org/dnkl/foot/issues/1607
|
[1607]: https://codeberg.org/dnkl/foot/issues/1607
|
||||||
|
[1840]: https://codeberg.org/dnkl/foot/issues/1840
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
|
||||||
15
uri.c
15
uri.c
|
|
@ -144,6 +144,21 @@ uri_parse(const char *uri, size_t len,
|
||||||
const char *query_start = memchr(start, '?', left);
|
const char *query_start = memchr(start, '?', left);
|
||||||
const char *fragment_start = memchr(start, '#', left);
|
const char *fragment_start = memchr(start, '#', left);
|
||||||
|
|
||||||
|
if (streq(*scheme, "file")) {
|
||||||
|
/* Don't try to parse query/fragment in file URIs, just treat
|
||||||
|
the remaining text as path */
|
||||||
|
query_start = NULL;
|
||||||
|
fragment_start = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (query_start != NULL && fragment_start != NULL &&
|
||||||
|
fragment_start < query_start)
|
||||||
|
{
|
||||||
|
/* Invalid URI - for now, ignore, and treat is as part of path */
|
||||||
|
query_start = NULL;
|
||||||
|
fragment_start = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size_t path_len =
|
size_t path_len =
|
||||||
query_start != NULL ? query_start - start :
|
query_start != NULL ? query_start - start :
|
||||||
fragment_start != NULL ? fragment_start - start :
|
fragment_start != NULL ? fragment_start - start :
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue