| 11065 | std::string_view input, const url_aggregator* base_url = nullptr); |
| 11066 | |
| 11067 | std::string href_from_file(std::string_view input) { |
| 11068 | // This is going to be much faster than constructing a URL. |
| 11069 | std::string tmp_buffer; |
| 11070 | std::string_view internal_input; |
| 11071 | if (unicode::has_tabs_or_newline(input)) { |
| 11072 | tmp_buffer = input; |
| 11073 | helpers::remove_ascii_tab_or_newline(tmp_buffer); |
| 11074 | internal_input = tmp_buffer; |
| 11075 | } else { |
| 11076 | internal_input = input; |
| 11077 | } |
| 11078 | std::string path; |
| 11079 | if (internal_input.empty()) { |
| 11080 | path = "/"; |
| 11081 | } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) { |
| 11082 | helpers::parse_prepared_path(internal_input.substr(1), |
| 11083 | ada::scheme::type::FILE, path); |
| 11084 | } else { |
| 11085 | helpers::parse_prepared_path(internal_input, ada::scheme::type::FILE, path); |
| 11086 | } |
| 11087 | return "file://" + path; |
| 11088 | } |
| 11089 | |
| 11090 | bool can_parse(std::string_view input, const std::string_view* base_input) { |
| 11091 | ada::url_aggregator base_aggregator; |
nothing calls this directly
no test coverage detected