Support absolute paths in setHTMLBody for automatic CID embedding #103
+65
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
setHTMLBody
in Nette\Mail supports abasePath
for automatically embedding local images as CID attachments. Relative paths likeimg/logo.svg
work correctly, but absolute paths starting with a slash (e.g./img/logo.svg
) are ignored and not embedded.This PR updates the logic so that images referenced with a leading slash are correctly resolved relative to the provided
basePath
, allowing projects that use Webpack-generated assets (which always output to a fixed public folder with leading slashes) to work without breaking existing templates that rely on relative paths.Here, basePath for mails is intended to represent the www folder of the application, making it clear that absolute paths are resolved relative to the web root.