mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LexicalPath: Reset dirname if it's empty
dirname ends up empty if the canonical path only contains one element. Reset it to the default for relative/absolute paths if that is the case.
This commit is contained in:
parent
c906987651
commit
0aaa992c1c
Notes:
sideshowbarker
2024-07-18 17:18:38 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/0aaa992c1ce Pull-request: https://github.com/SerenityOS/serenity/pull/7501
1 changed files with 4 additions and 0 deletions
|
@ -68,6 +68,10 @@ void LexicalPath::canonicalize()
|
|||
}
|
||||
m_dirname = dirname_builder.to_string();
|
||||
|
||||
if (m_dirname.is_empty()) {
|
||||
m_dirname = m_is_absolute ? "/" : ".";
|
||||
}
|
||||
|
||||
m_basename = canonical_parts.last();
|
||||
|
||||
Optional<size_t> last_dot = StringView(m_basename).find_last_of('.');
|
||||
|
|
Loading…
Reference in a new issue