| 11215 | } |
| 11216 | |
| 11217 | ada_really_inline bool shorten_path(std::string& path, |
| 11218 | ada::scheme::type type) noexcept { |
| 11219 | // Let path be url's path. |
| 11220 | // If url's scheme is "file", path's size is 1, and path[0] is a normalized |
| 11221 | // Windows drive letter, then return. |
| 11222 | if (type == ada::scheme::type::FILE && |
| 11223 | path.find('/', 1) == std::string_view::npos && !path.empty()) { |
| 11224 | if (checkers::is_normalized_windows_drive_letter( |
| 11225 | helpers::substring(path, 1))) { |
| 11226 | return false; |
| 11227 | } |
| 11228 | } |
| 11229 | |
| 11230 | // Remove path's last item, if any. |
| 11231 | size_t last_delimiter = path.rfind('/'); |
| 11232 | if (last_delimiter != std::string::npos) { |
| 11233 | path.erase(last_delimiter); |
| 11234 | return true; |
| 11235 | } |
| 11236 | |
| 11237 | return false; |
| 11238 | } |
| 11239 | |
| 11240 | ada_really_inline bool shorten_path(std::string_view& path, |
| 11241 | ada::scheme::type type) noexcept { |
no test coverage detected