prevent downloading folder html
This commit is contained in:
parent
da5a4034ae
commit
3379be84bd
@ -312,13 +312,22 @@ class Package extends ActiveRecord
|
|||||||
}
|
}
|
||||||
if (!$this->readme) {
|
if (!$this->readme) {
|
||||||
foreach (['README.txt', 'readme.txt', 'Readme.txt', 'README', 'readme'] as $file) {
|
foreach (['README.txt', 'readme.txt', 'Readme.txt', 'README', 'readme'] as $file) {
|
||||||
|
$text = strtolower($file) != 'readme';
|
||||||
|
if (!$text) {
|
||||||
|
foreach (get_headers(Git::getUrl($this->url, $file)) as $header) {
|
||||||
|
if ($header == 'Content-Type: text/plain') {
|
||||||
|
$text = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($text) {
|
||||||
$this->readme = Git::getFile($this->url, $file);
|
$this->readme = Git::getFile($this->url, $file);
|
||||||
if ($this->readme) {
|
if ($this->readme) {
|
||||||
$this->readme_format = 'text';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user