Skip to content

Commit 8df8a49

Browse files
committed
Fix NSURL parsing to correctly handle URLs with query or fragment delimiters but no path component
1 parent 0ced6b9 commit 8df8a49

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2025-10-22 Frederik Seiffert <frederik@algoriddim.com>
2+
3+
* Source/NSURL.m:
4+
Fix NSURL parsing to correctly handle URLs with query or fragment
5+
delimiters but no path component.
6+
17
2025-10-01 Richard Frith-Macdonald <rfm@gnu.org>
28

39
* Source/Additions/Unicode.m:

Source/NSURL.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,8 +995,18 @@ - (id) initWithString: (NSString*)aUrlString
995995
/*
996996
* Set 'end' to point to the start of the path, or just past
997997
* the 'authority' if there is no path.
998+
* Check for delimiters in order: '/' (path), '?' (query), '#' (fragment).
999+
* This properly delimits the authority section (RFC 3986).
9981000
*/
9991001
end = strchr(start, '/');
1002+
if (end == 0)
1003+
{
1004+
end = strchr(start, '?');
1005+
}
1006+
if (end == 0)
1007+
{
1008+
end = strchr(start, '#');
1009+
}
10001010
if (end == 0)
10011011
{
10021012
buf->hasNoPath = YES;

0 commit comments

Comments
 (0)