fix: adds download url check for monitors
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after -1m0s
Some checks failed
SonarQube Scan / SonarQube Trigger (push) Failing after -1m0s
This commit is contained in:
@@ -25,6 +25,10 @@ class DownloadOptionEvaluator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false === $this->validateDownloadUrl($result->url)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,4 +83,18 @@ class DownloadOptionEvaluator
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validateDownloadUrl(string $downloadUrl)
|
||||||
|
{
|
||||||
|
$badFileLocations = [
|
||||||
|
'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.',
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = get_headers($downloadUrl, true);
|
||||||
|
if (array_key_exists($headers['Location'], $badFileLocations)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user