[L9] Undocumented breaking change in Illuminate\Mail\Message::embed() #41837
-
I'm hoping that someone here can tell me whether it makes sense to file a bug report, or a PR to the upgrade guide in laravel/docs. Before Laravel 9, it was possible to embed external images in e-mails like this: <img src="{{ $message->embed('https://example.com/image.png') }}"> Basically the underlying In Laravel 9 this results in a In order to achieve something similar in Laravel 9, you would have to do this: <img src="{{ $message->embedData(file_get_contents('https://example.com/image.png'), Str::random(10)) }}"> I realise that the docs never mentioned explicitly that you could embed images from an URL, so it's more like an undocumented feature that broke in Laravel 9. Calling it a bug doesn't seem fair. But maybe it's worth mentioning this in the upgrade guide in case I'm not the only person who was using this "feature"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To me it looks like a case of unintended use of an API happened to work thanks to the implementation details of the underlying code. It basically boils down to |
Beta Was this translation helpful? Give feedback.
To me it looks like a case of unintended use of an API happened to work thanks to the implementation details of the underlying code. It basically boils down to
Swift_ByteStream_FileByteStream::read()
doesn't have the sameis_readable($path)
check thatSymfony\Component\Mime\Part\DataPart::fromPath()
does before trying to open a file resource. I doubt it's worth calling this specific use case out in the upgrade guide just because of how much of an edge case it looks to be, plus it borderline not being "correct" API usage.