1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

AK: Add hostname parameter to URL::create_with_file_scheme()

This adds a hostname parameter as the third parameter to
URL::create_with_file_scheme(). If the hostname is "localhost", it will
be ignored (as per the URL specification).

This can for example be used by ls(1) to create more conforming file
URLs.
This commit is contained in:
Max Wipfli 2021-05-29 21:57:20 +02:00 committed by Andreas Kling
parent ce80188d6f
commit 5caaa52bee
2 changed files with 6 additions and 3 deletions

View file

@ -92,7 +92,7 @@ public:
const String& data_payload() const { return m_data_payload; }
static URL create_with_url_or_path(const String&);
static URL create_with_file_scheme(const String& path, const String& fragment = {});
static URL create_with_file_scheme(const String& path, const String& fragment = {}, const String& hostname = {});
static URL create_with_file_protocol(const String& path, const String& fragment = {}) { return create_with_file_scheme(path, fragment); }
static URL create_with_data(const StringView& mime_type, const StringView& payload, bool is_base64 = false);