Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #initializeFromString: in WAUrl to take into account that ‘://’ can also be included in the query #1377

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ initializeFromString: aString
to: (fragmentIndex = 0 ifTrue: [ stringSize + 1 ] ifFalse: [ fragmentIndex ]) ].
schemeIndex := aString indexOfSubCollection: '://'.

(schemeIndex > 0 and: [ fragmentIndex = 0 or: [ schemeIndex < fragmentIndex ] ])
(schemeIndex > 0 and: [ (fragmentIndex = 0 or: [ schemeIndex < fragmentIndex ]) and: [ queryIndex = 0 or: [ schemeIndex < queryIndex ] ] ])
ifTrue: [
startWithPath := false.
self scheme: (aString copyFrom: 1 to: schemeIndex - 1).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ testNastyEdgeCasesParsing
decodedWith: GRNullCodec new.
self assert: url path first = 'blue/red?and+green'.

url := WAUrl absolute: '/blue?http://example.com/red'.
self assert: url path = (OrderedCollection with: 'blue').
self assert: url queryFields keys = #('http://example.com/red').
self assert: url queryFields values = #(nil).

url := (WAUrl absolute: 'http://example.com/:@-._~!$&''()*+,=;:@-._~!$&''()*+,=:@-._~!$&''()*+,==?/?:@-._~!$''()*+,;=/?:@-._~!$''()*+,;==#/?:@-._~!$&''()*+,;=')
decodedWith: GRNullCodec new.
self assert: url path first = ':@-._~!$&''()*+,='.
Expand Down