-
Notifications
You must be signed in to change notification settings - Fork 280
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
Safe signature #445
Safe signature #445
Conversation
67e7e38
to
3a8507b
Compare
NSString *domain = NSProcessInfo.processInfo.hostName ?: @"nowhere.local"; | ||
email = [NSString stringWithFormat:@"%@@%@", username, domain]; | ||
} | ||
if (email == nil) email = self.class.defaultEmail; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't this be a length check too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libgit2 used to be fine with empty emails: libgit2/libgit2@76e3c43
Apparently not anymore 😢
Can we unart test this too? |
I went back and forth on whether we should test for |
What do you mean? I was thinking we could just test that invalid strings result in the default. |
Ah, sorry, I meant that if we detect that the email address has |
If there's a libgit2 API to check validity without actually instantiating a signature, we could test that with the given username and email separately, then both together. If that sort of thing doesn't exist, I think this implementation is fine. |
Sadly no. 🍂 |
🍃 |
Create a signature using default values if libgit2’s validation fails.