mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-11 20:16:02 +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: 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/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