+ } else {
+ $valid_url = rtrim($valid_url, '/');
+ }
+
+ if (!Strings::compareLink($url, $valid_url)) {
+ // We only follow redirects when the path stays the same or the target url has no path.
+ // Some systems have got redirects on their landing page to a single account page. This check handles it.
+ if (((parse_url($url, PHP_URL_HOST) != parse_url($valid_url, PHP_URL_HOST)) && (parse_url($url, PHP_URL_PATH) == parse_url($valid_url, PHP_URL_PATH))) ||
+ (((parse_url($url, PHP_URL_HOST) != parse_url($valid_url, PHP_URL_HOST)) || (parse_url($url, PHP_URL_PATH) != parse_url($valid_url, PHP_URL_PATH))) && empty(parse_url($valid_url, PHP_URL_PATH)))) {
+ Logger::debug('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $valid_url]);
+ self::setFailure($url);
+ if (!self::getID($valid_url, true)) {
+ self::detect($valid_url, $network, $only_nodeinfo);
+ }
+ return false;
+ }