mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Browser: Treat absolute path as local file
This commit is contained in:
parent
d6796d5123
commit
f51e8e785c
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/tbhaxor Commit: https://github.com/SerenityOS/serenity/commit/f51e8e785c Pull-request: https://github.com/SerenityOS/serenity/pull/21248
1 changed files with 9 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <Applications/Browser/TabGML.h>
|
||||
#include <Applications/BrowserSettings/Defaults.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
|
@ -702,6 +703,14 @@ void Tab::update_reset_zoom_button()
|
|||
Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
|
||||
{
|
||||
DeprecatedString text = m_location_box->text();
|
||||
if (text.starts_with('/') && FileSystem::is_regular_file(text)) {
|
||||
auto real_path = FileSystem::real_path(text);
|
||||
if (real_path.is_error()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return URL::create_with_file_scheme(real_path.value().to_deprecated_string());
|
||||
}
|
||||
|
||||
StringBuilder builder;
|
||||
builder.append(text);
|
||||
|
|
Loading…
Reference in a new issue