Skip to content

Commit 9cde9a2

Browse files
🐛 fix: Add base64 decode within try except scope
1 parent 20a2ba1 commit 9cde9a2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Horse.BasicAuthentication.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED
139139
LBasicAuthenticationDecode.Delimiter := ':';
140140
LBasicAuthenticationDecode.StrictDelimiter := True;
141141
LBase64String := LBasicAuthenticationEncode.Trim.Replace(BASIC_AUTH, '', [rfIgnoreCase]);
142-
LBasicAuthenticationDecode.DelimitedText := {$IF DEFINED(FPC)}DecodeStringBase64(LBase64String){$ELSE}TBase64Encoding.base64.Decode(LBase64String){$ENDIF};
143142

144143
try
144+
LBasicAuthenticationDecode.DelimitedText := {$IF DEFINED(FPC)}DecodeStringBase64(LBase64String){$ELSE}TBase64Encoding.base64.Decode(LBase64String){$ENDIF};
145+
145146
if Assigned(AuthenticateWithResponse) then
146147
begin
147148
LIsAuthenticated := AuthenticateWithResponse(LBasicAuthenticationDecode.Strings[0], LBasicAuthenticationDecode.Strings[1], Res);

0 commit comments

Comments
 (0)