Skip to content

Commit 98bdbc5

Browse files
committed
fix: Use %20 instead of + for encoded spaces
1 parent dd7a7ef commit 98bdbc5

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"CFzxing":"^1.1.0"
1919
},
2020
"devDependencies":{
21-
"testbox":"stable"
21+
"testbox":"^4.0.0"
2222
},
2323
"installPaths":{
2424
"testbox":"testbox/",

models/TOTP.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ component singleton accessors="true" {
7777
return arrayToList(
7878
[
7979
"otpauth://totp/",
80-
encodeForURL( arguments.issuer ),
80+
urlEncodedFormat( arguments.issuer ),
8181
":",
8282
arguments.email,
8383
"?secret=",
8484
arguments.secret,
8585
"&issuer=",
86-
encodeForURL( arguments.issuer )
86+
urlEncodedFormat( arguments.issuer )
8787
],
8888
""
8989
);

tests/specs/unit/TOTPSpec.cfc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ component extends="testbox.system.BaseSpec" {
157157
secret = secret
158158
);
159159
expect( totpUrl ).toBe(
160-
"otpauth://totp/#encodeForURL( issuer )#:#email#?secret=#secret#&issuer=#encodeForURL( issuer )#"
160+
"otpauth://totp/Example%20Company:john@example.com?secret=#secret#&issuer=Example%20Company"
161161
);
162162
} );
163163
} );
@@ -223,7 +223,7 @@ component extends="testbox.system.BaseSpec" {
223223
expect( config.secret ).toMatchWithCase( "^[A-Z2-7]+=*$", "Secret must be a valid Base32 string." );
224224
expect( config ).toHaveKey( "url" );
225225
expect( config.url ).toBe(
226-
"otpauth://totp/#encodeForURL( issuer )#:#email#?secret=#config.secret#&issuer=#encodeForURL( issuer )#"
226+
"otpauth://totp/Example%20Company:john@example.com?secret=#config.secret#&issuer=Example%20Company"
227227
);
228228
expect( config ).toHaveKey( "qrCode" );
229229
expect( isImage( config.qrCode ) ).toBeTrue( "An image should have been returned" );

0 commit comments

Comments
 (0)