Skip to content

Commit

Permalink
fix(mimetype): Fix returning value when finding existing mimetype in …
Browse files Browse the repository at this point in the history
  • Loading branch information
tcitworld committed May 4, 2023
1 parent b44de9c commit f584c5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/private/Files/Type/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ protected function store($mimetype) {
throw $e;
}
$qb = $this->dbConnection->getQueryBuilder();
$row = $qb->select('id')
$id = $qb->select('id')
->from('mimetypes')
->where($qb->expr()->eq('mimetype', $qb->createNamedParameter($mimetype)))
->executeQuery()
->fetchOne();
if ($row) {
if ($id) {
return [
'mimetype' => $mimetype,
'id' => $row['id'],
'id' => $id,
];
}
throw new \Exception("Database threw an unique constraint on inserting a new mimetype, but couldn't return the ID for this very mimetype");
Expand Down

0 comments on commit f584c5f

Please sign in to comment.