mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
Browser: Treat absolute path as local file
This commit is contained in:
parent
d6796d5123
commit
f51e8e785c
1 changed files with 9 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <Applications/Browser/TabGML.h>
|
#include <Applications/Browser/TabGML.h>
|
||||||
#include <Applications/BrowserSettings/Defaults.h>
|
#include <Applications/BrowserSettings/Defaults.h>
|
||||||
#include <LibConfig/Client.h>
|
#include <LibConfig/Client.h>
|
||||||
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/BoxLayout.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)
|
Optional<URL> Tab::url_from_location_bar(MayAppendTLD may_append_tld)
|
||||||
{
|
{
|
||||||
DeprecatedString text = m_location_box->text();
|
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;
|
StringBuilder builder;
|
||||||
builder.append(text);
|
builder.append(text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue