Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(RecipeService): Catch recipe folder not being a folder
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin authored and christianlupus committed Mar 5, 2025
commit fcefabbb6568f9e33053ae78afd4e7222ae1e78e
3 changes: 3 additions & 0 deletions lib/Service/RecipeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ public function addRecipe($json, $importedHtml = null) {
if (isset($json['id']) && $json['id']) {
// Recipe already has an id, update it
$recipe_folder = $user_folder->getById($json['id'])[0];
if (!($recipe_folder instanceof Folder)) {
throw new \RuntimeException($this->il10n->t('Unexpected node received for recipe folder.'));
}

$old_path = $recipe_folder->getPath();
$new_path = dirname($old_path) . '/' . $recipeFolderName;
Expand Down
6 changes: 0 additions & 6 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@
<code><![CDATA[$this->root]]></code>
<code><![CDATA[IRootFolder]]></code>
</MissingDependency>
<UndefinedInterfaceMethod>
<code><![CDATA[newFile]]></code>
<code><![CDATA[newFile]]></code>
<code><![CDATA[newFile]]></code>
<code><![CDATA[nodeExists]]></code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/Service/ThumbnailService.php">
<MissingDependency>
Expand Down