encode url for download

This commit is contained in:
Robin Appelman 2020-02-14 14:09:48 +01:00
commit b0ac0adb30

View file

@ -17,7 +17,10 @@ class Backup {
} }
private function backupDemo(string $name, string $url, string $hash): bool { private function backupDemo(string $name, string $url, string $hash): bool {
$handle = fopen($url, 'r'); $encodedUrl = rawurlencode($url);
$encodedUrl = str_replace('%2F', '/', $encodedUrl);
$encodedUrl = str_replace('%3A//', '://', $encodedUrl);
$handle = fopen($encodedUrl, 'r');
$storedHash = $this->store->store($name, $handle); $storedHash = $this->store->store($name, $handle);
return $hash === '' || $hash === $storedHash; return $hash === '' || $hash === $storedHash;
} }