diff options
-rw-r--r-- | AK/URL.cpp | 10 | ||||
-rw-r--r-- | AK/URL.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/AK/URL.cpp b/AK/URL.cpp index d029282b95..8c77031b88 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -297,4 +297,14 @@ URL URL::create_with_file_protocol(const String& path) return url; } +URL URL::create_with_url_or_path(const String& url_or_path) +{ + URL url = url_or_path; + if (url.is_valid()) + return url; + + String path = canonicalized_path(url_or_path); + return URL::create_with_file_protocol(path); +} + } @@ -65,6 +65,7 @@ public: URL complete_url(const String&) const; + static URL create_with_url_or_path(const String& url_or_path); static URL create_with_file_protocol(const String& path); private: |