mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
Everywhere: Remove some use of the URL constructors
These make it too easy to construct an invalid URL, which makes it difficult to remove the valid state of URL - which this API relies on.
This commit is contained in:
parent
2823ac92d0
commit
d62cf0a807
Notes:
github-actions[bot]
2025-02-19 13:02:46 +00:00
Author: https://github.com/shannonbooth
Commit: d62cf0a807
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3609
Reviewed-by: https://github.com/trflynn89
11 changed files with 341 additions and 329 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MimeData.h>
|
||||
#include <LibURL/Parser.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -18,7 +19,8 @@ Vector<URL::URL> MimeData::urls() const
|
|||
return {};
|
||||
Vector<URL::URL> urls;
|
||||
for (auto& line : StringView(it->value).split_view('\n')) {
|
||||
urls.append(URL::URL(line));
|
||||
if (auto maybe_url = URL::Parser::basic_parse(line); maybe_url.has_value())
|
||||
urls.append(maybe_url.release_value());
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue