craftcms / redactor

Edit rich text content in Craft CMS using Redactor by Imperavi.
https://plugins.craftcms.com/redactor
MIT License
100 stars 48 forks source link

[4.x]: Images added in Redactor field initially have wrong URL before save #441

Closed robmcfadden closed 1 year ago

robmcfadden commented 1 year ago

What happened?

Description

Redactor field, adding an image, the selector works fine and shows the images. Once you select, though, it initially adds the image into the redactor field with a broken URL. On save, it fixes itself.

My guess is the JS is having an issue placing the image into redactor initially, but because of the #asset:911:url on the end, Craft sorts itself out on save. I tested this by changing the broken version of the URL before save to something random, preserving the hash on the end, and it still corrects itself on save. It may be a coincidence, but breaks at the underscore. There could be a hard character limit or some code that doesn't like the underscore?

After initial add, before save... https://mirionv4prodstorage.blob.core.windows.net/mirionv4-prod-20221024-ciqld3yuh8/cms41.png#asset:911:url

after-initial-adding

After save... https://mirionv4prodstorage.blob.core.windows.net/mirionv4-prod-20221024-ciqld3yuh8/cms4_mirion/files/1.png#asset:911:url

after-save

Craft CMS version

Craft Pro 4.3.4

PHP version

8.1.9

Operating system and version

Linux 5.10.104-linuxkit

Database type and version

MySQL 8.0.27

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-35)

Installed plugins and versions

Amazon S3 2.0.1 Azure Blob Storage 2.0.0 Blitz 4.2.3 Color Mixer 3.0.0 CP Field Inspect 1.4.4 Element API 3.0.1.1 Embedded Assets 3.1.0 Environment Label 4.0.2 Expanded Singles 2.0.0 Feed Me 5.0.4 Formie 2.0.18 Imager X 4.1.8 MatrixMate 2.1.2 Redactor 3.0.2 Redactor Split 4.0.0 Reverse Relations 2.0.0 Scout 3.0.0 SEO Content 4.0.15 SEO Redirects 4.1.6 Similar 4.0.0 Super Table 3.0.7 Table Maker 4.0.3 Typed link field 2.1.5 UI Element fields 2.0.2 Vite 4.0.3

brandonkelly commented 1 year ago

What is your filesystem’s Base URL set to?

(And if it references an alias or environment variable, what is that set to?)

robmcfadden commented 1 year ago

Base URL: $BLOB_BASE_URLhttps://mirionv4prodstorage.blob.core.windows.net/mirionv4-prod-20221024-ciqld3yuh8/ Subfolder: cms4_mirion/files

brandonkelly commented 1 year ago

This is now fixed in Redactor 2.10.11 (Craft 3) and 3.0.3 (Craft 4).

robmcfadden commented 1 year ago

Thanks, @brandonkelly! And Happy New Year! 🎉