Skip to content

Commit ec976a3

Browse files
committed
fix(#94): Check version existence before updating content
1 parent d4bbb16 commit ec976a3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

commands/clean/content.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@
4343
$data[$originalField] = null;
4444
}
4545

46-
// try to update the page with the data
47-
$item->update($data, $lang);
46+
// get the latest version of the item
47+
$version = $item->version('latest');
48+
49+
// check if the version exists for the given language
50+
// and try to update the page with the data
51+
if ($version->exists($lang ?? 'default') === true) {
52+
$version->update($data, $lang ?? 'default');
53+
}
4854
}
4955
}
5056
};

0 commit comments

Comments
 (0)