Skip to content

Commit

Permalink
Merge pull request #33 from AlexOConnorHub/hotfix_1.0.3
Browse files Browse the repository at this point in the history
`str_replace` causes error - now `basename`
  • Loading branch information
ncjoes authored Sep 30, 2021
2 parents 402e9ff + 2af8b1f commit f82ab2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/OfficeConverter/OfficeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ protected function makeCommand($outputDirectory, $outputExtension)
protected function prepOutput($outdir, $filename, $outputExtension)
{
$DS = DIRECTORY_SEPARATOR;
$tmpName = ($this->extension ? str_replace($this->extension, '', $this->basename) : $this->basename . '.').$outputExtension;
$fileBaseName = basename($filename);
if (rename($outdir.$DS.$tmpName, $outdir.$DS.$fileBaseName)) {
return $outdir.$DS.$fileBaseName;
$tmpName = ($this->extension ? basename($this->basename, $this->extension) : $this->basename . '.').$outputExtension;
if (rename($outdir.$DS.$tmpName, $outdir.$DS.$filename)) {
return $outdir.$DS.$filename;
} elseif (is_file($outdir.$DS.$tmpName)) {
return $outdir.$DS.$tmpName;
}
Expand Down

0 comments on commit f82ab2c

Please sign in to comment.