mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +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: 3115a5306d
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())
|
if (original_line.is_empty())
|
||||||
break;
|
break;
|
||||||
auto trimmed_line = original_line.view().trim_whitespace();
|
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) {
|
if (fields.size() < 2) {
|
||||||
dbgln("Failed to parse line {} from '/etc/hosts': '{}'", line_number, original_line);
|
dbgln("Failed to parse line {} from '/etc/hosts': '{}'", line_number, original_line);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue