know your libraries ;-)
strrpos fails in cases the file in the path has no dot but the parent folder
This commit is contained in:
parent
0c73cae77b
commit
ddc7af9a53
1 changed files with 1 additions and 5 deletions
|
@ -509,11 +509,7 @@ class View {
|
|||
if (Filesystem::isValidPath($path)) {
|
||||
$source = $this->fopen($path, 'r');
|
||||
if ($source) {
|
||||
$extension = '';
|
||||
$extOffset = strpos($path, '.');
|
||||
if ($extOffset !== false) {
|
||||
$extension = substr($path, strrpos($path, '.'));
|
||||
}
|
||||
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
||||
$tmpFile = \OC_Helper::tmpFile($extension);
|
||||
file_put_contents($tmpFile, $source);
|
||||
return $tmpFile;
|
||||
|
|
Loading…
Reference in a new issue