mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-13 01:40:36 +00:00
LookupServer: Fix to handle whitespaces and tabs in /etc/hosts
This commit is contained in:
parent
fe50598a03
commit
3115a5306d
Notes:
sideshowbarker
2024-07-18 03:02:51 +09:00
Author: https://github.com/fleximus 🔰 Commit: https://github.com/SerenityOS/serenity/commit/3115a5306df Pull-request: https://github.com/SerenityOS/serenity/pull/10341 Issue: https://github.com/SerenityOS/serenity/issues/10316 Reviewed-by: https://github.com/gmta
1 changed files with 2 additions and 1 deletions
|
@ -107,7 +107,8 @@ void LookupServer::load_etc_hosts()
|
|||
if (original_line.is_empty())
|
||||
break;
|
||||
auto trimmed_line = original_line.view().trim_whitespace();
|
||||
auto fields = trimmed_line.split_view('\t', false);
|
||||
auto replaced_line = trimmed_line.replace(" ", "\t", true);
|
||||
auto fields = replaced_line.split_view('\t', false);
|
||||
|
||||
if (fields.size() < 2) {
|
||||
dbgln("Failed to parse line {} from '/etc/hosts': '{}'", line_number, original_line);
|
||||
|
|
Loading…
Reference in a new issue