fix(webhooks): improve Nextcloud 33 compatibility and HA REST notify payload handling
- Replace getFolder() with get() and fallback creation to fix LazyFolder compatibility in NC33 - Add support for unwrapping nested 'data' keys in Home Assistant REST notify payloads - Implement fallback to $_GET when request body is empty - Refactor buildRichObject to use direct PDO queries for filecache and share creation, bypassing lazy node resolution - Generate timestamped filenames for uploaded images to prevent overwrites - Add comprehensive logging for webhook payloads, image processing, and filecache verification - Update IShareManager imports and usage to align with Nextcloud API changes - Improve image attachment handling to support URLs, base64, and file paths - Wrap image processing in try-catch to prevent webhook crashes on image failures
This commit is contained in:
@@ -35,9 +35,14 @@ class ImageCleanup implements IJob {
|
||||
}
|
||||
|
||||
// Check if images directory exists
|
||||
// LazyFolder in Nextcloud 33 doesn't delegate getFolder() properly
|
||||
try {
|
||||
$userFolder = $this->rootFolder->getUserFolder($bot->getUID());
|
||||
$imagesDir = $userFolder->getFolder('nc_bot_webhooks-images');
|
||||
try {
|
||||
$userFolder->get('nc_bot_webhooks-images');
|
||||
} catch (\OCP\Files\NotFoundException $e) {
|
||||
return;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user