Skip to content

Commit b048aad

Browse files
fix: improve ios bundleID regex to stop bundleIDs from throwing incorrectly (#357)
Co-authored-by: russellwheatley <[email protected]>
1 parent 2a0f09a commit b048aad

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

packages/flutterfire_cli/lib/src/common/utils.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ void validateAppBundleId(
511511
String platform,
512512
) {
513513
final bundleIdRegex = RegExp(
514-
r'^[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)+$',
514+
r'^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?|([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?)+))$',
515515
);
516516

517517
if (!bundleIdRegex.hasMatch(bundleId)) {

packages/flutterfire_cli/test/unit_test.dart

+14-7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ void main() {
4242
),
4343
returnsNormally,
4444
);
45+
expect(
46+
() => validateAppBundleId(
47+
'example',
48+
kIos,
49+
),
50+
returnsNormally,
51+
);
52+
expect(
53+
() => validateAppBundleId(
54+
'exampleEN',
55+
kIos,
56+
),
57+
returnsNormally,
58+
);
4559
});
4660

4761
test('Invalid bundle IDs', () {
@@ -73,13 +87,6 @@ void main() {
7387
),
7488
throwsA(isA<ValidationException>()),
7589
);
76-
expect(
77-
() => validateAppBundleId(
78-
'example',
79-
kIos,
80-
),
81-
throwsA(isA<ValidationException>()),
82-
);
8390
});
8491
});
8592

0 commit comments

Comments
 (0)