You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In issue #1157 only #decodePercent: was fixed. However, #decodePercent:from:to: and #decodePercentAndPlus:from:to: should also be fixed as I said here.
My proposed changes:
WAUrlclass>>decodePercent: aString from: start to: end
"percent decodes the string starting at the given index"
| inputoutputindexleft |
index := aString indexOf: $% startingAt: start.
(index =0or: [ index >= end ])
ifTrue: [ ^ aString copyFrom: start to: end -1 ].
input := aString readStream.
input skip: start -1. "start index 1 -> skip 0"
output :=WriteStreamon: (Stringnew: aString size).
left := end - start.
[ left >0and: [ input atEnd not ] ] whileTrue: [
| char |
char := input next.
output nextPut: (char = $%
ifTrue: [
| firstBytesecondByte |
firstByte :=selfreadHexFrom: input errorDetail: aString.
secondByte :=selfreadHexFrom: input errorDetail: aString.
left := left -3.
CharactercodePoint:firstByte *16+ secondByte ]
ifFalse: [
left := left -1.
char ]) ].
^ output contents
and
WAUrlclass>>decodePercentAndPlus: aString from: start to: end
"percent decodes the given String"
| percentIndexinputoutputleft |
"check if we contain %"
percentIndex := aString indexOf: $% startingAt: start.
(percentIndex =0or: [ percentIndex >= end ]) ifTrue: [
| plusIndex |
"check if we contain +"
plusIndex := aString indexOf: $+startingAt: start.
(plusIndex =0or: [ plusIndex >= end ]) ifTrue: [
^ aString copyFrom: start to: end -1 ] ].
"we contain either % or +"
input := aString readStream.
input skip: start -1. "start index 1 -> skip 0"
output :=WriteStreamon: (Stringnew: aString size).
left := end - start.
[ left >0and: [ input atEnd not ] ] whileTrue: [
| char |
char := input next.
output nextPut: (char = $+ifTrue: [
left := left -1.
Character space ]
ifFalse: [
char = $%
ifTrue: [
| firstBytesecondByte |
firstByte :=selfreadHexFrom: input errorDetail: aString.
secondByte :=selfreadHexFrom: input errorDetail: aString.
left := left -3.
CharactercodePoint:firstByte *16+ secondByte ]
ifFalse: [
left := left -1.
char ] ]) ].
^ output contents
ps: sorry I cannot make a PR, but I don't have a Pharo at hand and I don't know how to use Iceberg with Filetree. Hopefully someone can take it from here.
The text was updated successfully, but these errors were encountered:
marianopeck
added a commit
to instantiations/Seaside
that referenced
this issue
Jul 19, 2021
In issue #1157 only
#decodePercent:
was fixed. However,#decodePercent:from:to:
and#decodePercentAndPlus:from:to:
should also be fixed as I said here.My proposed changes:
and
ps: sorry I cannot make a PR, but I don't have a Pharo at hand and I don't know how to use Iceberg with Filetree. Hopefully someone can take it from here.
The text was updated successfully, but these errors were encountered: