* @return true if @p url is non-empty, valid and has a clean path, false otherwise. */
| 76 | * @return true if @p url is non-empty, valid and has a clean path, false otherwise. |
| 77 | */ |
| 78 | inline bool isValidURL(const IndexedString& url) |
| 79 | { |
| 80 | if (url.isEmpty()) { |
| 81 | return false; |
| 82 | } |
| 83 | QUrl original = url.toUrl(); |
| 84 | if (!original.isValid() || original.isRelative() || (original.fileName().isEmpty() && original.isLocalFile())) { |
| 85 | qCWarning(LANGUAGE) << "INVALID URL ENCOUNTERED:" << url << original; |
| 86 | return false; |
| 87 | } |
| 88 | QUrl cleaned = original.adjusted(QUrl::NormalizePathSegments); |
| 89 | return original == cleaned; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | struct DocumentParseTarget |
no test coverage detected