日期:[2025-01-09]
功能增加
添加Mediaembed插件,实现b站等外链直接识别,并嵌入
错误修复
修复访问个人主页的回复页面时,500报错,由upload qcos插件引起
报错日志:
GET https://bbs.cathi.cn/api/posts
TypeError: GBCLStudio\UploadExtQcloud\Configuration\QcloudConfiguration::generateUrl(): Argument #1 ($file) must be of type FoF\Upload\File, null given, called in /www/wwwroot/bbs.cathi.cn/vendor/gbcl/fof-upload-qcloud/src/Formatters/QcloudPreviewFormatter.php on line 41 and defined in /www/wwwroot/bbs.cathi.cn/vendor/gbcl/fof-upload-qcloud/src/Configuration/QcloudConfiguration.php:91
Stack trace:
#0 /www/wwwroot/bbs.cathi.cn/vendor/gbcl/fof-upload-qcloud/src/Formatters/QcloudPreviewFormatter.php(41): GBCLStudio\UploadExtQcloud\Configuration\QcloudConfiguration->generateUrl()
解决方法:
修改/www/wwwroot/bbs.cathi.cn/vendor/gbcl/fof-upload-qcloud/src/Formatters/QcloudPreviewFormatter.php on line 41部分代码,处理 $file 为 null 的情况,例如返回默认 URL 或抛出异常
public function __invoke(Renderer $renderer, mixed $context, string $xml): string
{
return Utils::replaceAttributes($xml, 'UPL-QCLOUD-PREVIEW', function ($attributes) {
$file = $this->files->findByUuid($attributes['uuid']);
if ($file === null) {
// 处理 $file 为 null 的情况,例如返回默认 URL 或抛出异常
return $attributes;
}
$preview_url = $this->config->generateUrl($file);
$file->url = $preview_url;
$file->save();
$attributes['preview_uri'] = $preview_url;
$attributes['fullscreen_uri'] = $this->config->generateUrl($file);
$attributes['base_name'] = $file->base_name;
return $attributes;
});
}