52 return check_author(author, allowed); |
52 return check_author(author, allowed); |
53 }); |
53 }); |
54 } |
54 } |
55 |
55 |
56 std::string_view trim(const std::string& str) { |
56 std::string_view trim(const std::string& str) { |
57 size_t s = str.find_first_not_of(" \t"); |
57 size_t s = str.find_first_not_of(" \t\r"); |
58 size_t l = str.find_last_not_of(" \t") + 1 - s; |
58 if (s == std::string::npos) return ""; |
|
59 size_t l = str.find_last_not_of(" \t\r") + 1 - s; |
59 return std::string_view{str}.substr(s, l); |
60 return std::string_view{str}.substr(s, l); |
60 } |
61 } |
61 |
62 |
62 int settings::parse_authormap(const std::string& path) { |
63 int settings::parse_authormap(const std::string& path) { |
63 std::ifstream file(path); |
64 std::ifstream file(path); |