jgm / gitit

A wiki using HAppS, pandoc, and git
GNU General Public License v2.0
2.16k stars 226 forks source link

Use primary GitHub email rather than just the first #526

Closed Rufflewind closed 8 years ago

Rufflewind commented 8 years ago

The order in which user emails are returned via the GitHub API is not specified, so the first may not be the one that the user prefers, i.e. the so-called "primary" email. To fix this problem, we eliminate all emails except for the one marked as "primary".

Rufflewind commented 8 years ago

But I'm a bit worried about the unsafe partial function 'head' here (if the list is empty, it will just crash).

I assume under normal circumstances GitHub would forbid a user account without a primary email, but it's remains possible that something could go wrong due to a problem beyond the control of Gitit (e.g. if the API call gets intercepted due to a malicious root CA).