Skip to content

Commit 49b70c0

Browse files
chrisbobbegnprice
authored andcommitted
RealmInputScreen: Ignore leading/trailing whitespace in input value
1 parent e8ad88c commit 49b70c0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/start/RealmInputScreen.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ type MaybeParsedInput =
4343
| {| +valid: false, error: ValidationError |};
4444

4545
const tryParseInput = (realmInputValue: string): MaybeParsedInput => {
46-
const withScheme = /^https?:\/\//.test(realmInputValue)
47-
? realmInputValue
48-
: `https://${realmInputValue}`;
46+
const trimmedInputValue = realmInputValue.trim();
47+
48+
const withScheme = /^https?:\/\//.test(trimmedInputValue)
49+
? trimmedInputValue
50+
: `https://${trimmedInputValue}`;
4951

5052
const url = tryParseUrl(withScheme);
5153

0 commit comments

Comments
 (0)