diff --git a/vanilla/library/Vanilla/EmbeddedContent/Embeds/FileEmbed.php b/vanilla/library/Vanilla/EmbeddedContent/Embeds/FileEmbed.php new file mode 100644 index 0000000..ac06059 --- /dev/null +++ b/vanilla/library/Vanilla/EmbeddedContent/Embeds/FileEmbed.php @@ -0,0 +1,65 @@ +data['url'] = file_embed_process_url($this->getUrl()); + } + return $this->renderTwig($viewPath, [ + 'url' => $this->data['url'], + 'name' => $this->data['name'], + 'data' => $this, + ]); + } + + /** + * @inheritdoc + */ + protected function schema(): Schema { + return new VanillaMediaSchema(false); + } +} diff --git a/vanilla/library/Vanilla/Formatting/Quill/Blots/Embeds/ExternalBlot.php b/vanilla/library/Vanilla/Formatting/Quill/Blots/Embeds/ExternalBlot.php index 7442a14..8c7c72f 100644 --- a/vanilla/library/Vanilla/Formatting/Quill/Blots/Embeds/ExternalBlot.php +++ b/vanilla/library/Vanilla/Formatting/Quill/Blots/Embeds/ExternalBlot.php @@ -117,6 +117,9 @@ public function renderQuote(): string { } elseif ($embedType == 'file') { $fileName = $data['name'] ?? ""; $size = $data['size'] ?? ""; + if (function_exists('file_embed_process_url')) { + $sanitizedUrl = file_embed_process_url($sanitizedUrl); + } if($fileName && $size) { $formattedSize = Gdn_Upload::formatFileSize($size,2); return "

$fileName ($formattedSize)

";