@@ -1847,68 +1847,6 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
1847
1847
registry->Register (DomainToUnicode);
1848
1848
}
1849
1849
1850
- std::string URL::ToFilePath () const {
1851
- if (context_.scheme != " file:" ) {
1852
- return " " ;
1853
- }
1854
-
1855
- #ifdef _WIN32
1856
- const char * slash = " \\ " ;
1857
- auto is_slash = [] (char ch) {
1858
- return ch == ' /' || ch == ' \\ ' ;
1859
- };
1860
- #else
1861
- const char * slash = " /" ;
1862
- auto is_slash = [] (char ch) {
1863
- return ch == ' /' ;
1864
- };
1865
- if ((context_.flags & URL_FLAGS_HAS_HOST) &&
1866
- context_.host .length () > 0 ) {
1867
- return " " ;
1868
- }
1869
- #endif
1870
- std::string decoded_path;
1871
- for (const std::string& part : context_.path ) {
1872
- std::string decoded = PercentDecode (part.c_str (), part.length ());
1873
- for (char & ch : decoded) {
1874
- if (is_slash (ch)) {
1875
- return " " ;
1876
- }
1877
- }
1878
- decoded_path += slash + decoded;
1879
- }
1880
-
1881
- #ifdef _WIN32
1882
- // TODO(TimothyGu): Use "\\?\" long paths on Windows.
1883
-
1884
- // If hostname is set, then we have a UNC path. Pass the hostname through
1885
- // ToUnicode just in case it is an IDN using punycode encoding. We do not
1886
- // need to worry about percent encoding because the URL parser will have
1887
- // already taken care of that for us. Note that this only causes IDNs with an
1888
- // appropriate `xn--` prefix to be decoded.
1889
- if ((context_.flags & URL_FLAGS_HAS_HOST) &&
1890
- context_.host .length () > 0 ) {
1891
- std::string unicode_host;
1892
- if (!ToUnicode (context_.host , &unicode_host)) {
1893
- return " " ;
1894
- }
1895
- return " \\\\ " + unicode_host + decoded_path;
1896
- }
1897
- // Otherwise, it's a local path that requires a drive letter.
1898
- if (decoded_path.length () < 3 ) {
1899
- return " " ;
1900
- }
1901
- if (decoded_path[2 ] != ' :' ||
1902
- !IsASCIIAlpha (decoded_path[1 ])) {
1903
- return " " ;
1904
- }
1905
- // Strip out the leading '\'.
1906
- return decoded_path.substr (1 );
1907
- #else
1908
- return decoded_path;
1909
- #endif
1910
- }
1911
-
1912
1850
URL URL::FromFilePath (const std::string& file_path) {
1913
1851
URL url (" file://" );
1914
1852
std::string escaped_file_path;
0 commit comments