mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:07:36 +00:00
AK+Everywhere: Change URL::path() to serialize_path()
This now defaults to serializing the path with percent decoded segments (which is what all callers expect), but has an option not to. This fixes `file://` URLs with spaces in their paths. The name has been changed to serialize_path() path to make it more clear that this method will generate a new string each call (except for the cannot_be_a_base_url() case). A few callers have then been updated to avoid repeatedly calling this function.
This commit is contained in:
parent
5acd40c525
commit
35612c6a7f
42 changed files with 131 additions and 123 deletions
|
@ -141,9 +141,10 @@ bool RunWindow::run_via_launch(DeprecatedString const& run_input)
|
|||
auto url = URL::create_with_url_or_path(run_input);
|
||||
|
||||
if (url.scheme() == "file") {
|
||||
auto real_path_or_error = FileSystem::real_path(url.path());
|
||||
auto file_path = url.serialize_path();
|
||||
auto real_path_or_error = FileSystem::real_path(file_path);
|
||||
if (real_path_or_error.is_error()) {
|
||||
warnln("Failed to launch '{}': {}", url.path(), real_path_or_error.error());
|
||||
warnln("Failed to launch '{}': {}", file_path, real_path_or_error.error());
|
||||
return false;
|
||||
}
|
||||
url = URL::create_with_url_or_path(real_path_or_error.release_value().to_deprecated_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue