Skip to content

Commit

Permalink
Merge pull request #50227 from nextcloud/fix/convert-log
Browse files Browse the repository at this point in the history
fix: Log exceptions that happen during file conversion
  • Loading branch information
juliusknorr authored Jan 17, 2025
2 parents 326120a + fc9af34 commit 6afe125
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/files/lib/Controller/ConversionApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCP\Files\IRootFolder;
use OCP\IL10N;
use OCP\IRequest;
use function OCP\Log\logger;

class ConversionApiController extends OCSController {
public function __construct(
Expand Down Expand Up @@ -80,7 +81,8 @@ public function convert(int $fileId, string $targetMimeType, ?string $destinatio
try {
$convertedFile = $this->fileConversionManager->convert($file, $targetMimeType, $destination);
} catch (\Exception $e) {
throw new OCSException($e->getMessage());
logger('files')->error($e->getMessage(), ['exception' => $e]);
throw new OCSException($this->l10n->t('The file could not be converted.'));
}

$convertedFileRelativePath = $userFolder->getRelativePath($convertedFile);
Expand Down

0 comments on commit 6afe125

Please sign in to comment.