Skip to content

Application Name with accent character causes exception. #2609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
LondonAtlas opened this issue Mar 21, 2019 · 1 comment · Fixed by #2906
Closed

Application Name with accent character causes exception. #2609

LondonAtlas opened this issue Mar 21, 2019 · 1 comment · Fixed by #2906
Milestone

Comments

@LondonAtlas
Copy link

  • Xcode version: 10.1 (10B61)
  • Firebase SDK version: 5.18.0
  • Firebase Component: Core
  • Component version: 5.3.1

[REQUIRED] Step 3: Describe the problem

When trying to configure the object FirebaseApp using the initialiser configure(name: String. options: FirebaseOptions)supplying an application name that contains an accent such asē` will cause an exception.

Steps to reproduce:

Running the following line will cause the exception App name should only contain Letters, Numbers, Underscores, and Dashes. to be thrown.
FirebaseApp.configure(name: "hēllo", options: options)

Looking at the source code there is an if check looking for characters above and below a-z A-Z and 0-9.

FIRApp.m: 161
if (!((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9') || character == '_' || character == '-')) { [NSException raise:kFirebaseCoreErrorDomain format:@"App name should only contain Letters, " @"Numbers, Underscores, and Dashes."]; }

Relevant Code:

let plistPath = Bundle.main.path(forResource: "MyGoogleServicePlist", ofType: "plist")
let googleService = try! PropertyListDecoder().decode(GoogleService.self, from: data)
let options = FirebaseOptions(googleAppID: googleService.appId, gcmSenderID: googleService.gcmId)
`FirebaseApp.configure(name: "hēllo", options: options)`

Due to a multi target workspace we are required to have custom names for the GoogleService-Info.plist which is why it contains a custom name in the sample above.

@paulb777
Copy link
Member

Thanks for the report. This code has an overly constrained test to make sure that the characters are valid in a filename.

In the short-term, I sent a PR (#2614) to improve the error message. In the longer term, we'd be happy to consider a PR with a more expansive test.

@maksymmalyhin maksymmalyhin added this to the M48 milestone Apr 27, 2019
@firebase firebase locked and limited conversation to collaborators Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants