[CLEAN] Synthetic Benchmark PR #36240 - FIX: maintain extension when quoting images #5
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.
User description
Benchmark PR discourse#36240
Type: Clean (correct implementation)
Original PR Title: FIX: maintain extension when quoting images
Original PR Description: Also do not show quote image to anonymous
Original PR URL: discourse#36240
PR Type
Bug fix, Enhancement
Description
Maintain file extension when quoting images with upload:// URLs
Hide quote image button from anonymous users
Refactor canQuoteImage to canBuildImageQuote for clarity
Extract extensionFromUrl utility function for reuse
Update tests to verify extension preservation in quotes
Diagram Walkthrough
File Walkthrough
lightbox.js
Restrict quote button visibility to authenticated usersfrontend/discourse/app/lib/lightbox.js
User.current()withhelperContext()?.currentUserfor bettercontext management
canQuoteImageflag based on current user authentication statusfrom anonymous users
canBuildImageQuotefunctionmarkdown-image-builder.js
Add extensionFromUrl utility functionfrontend/discourse/app/lib/markdown-image-builder.js
extensionFromUrlutility function to extract file extensionsfrom URLs
extensions
quote-image.js
Add extension preservation to upload URLsfrontend/discourse/app/lib/lightbox/quote-image.js
extensionFromUrlutility function from markdown-image-builderpresent
canQuoteImageexport tocanBuildImageQuotewith added JSDocdocumentation
to-markdown.js
Apply extension preservation to markdown conversionfrontend/discourse/app/lib/to-markdown.js
extensionFromUrlutility functiontags
data-download-href)
quote-image-test.js
Update tests for authentication and extension preservationfrontend/discourse/tests/unit/lib/lightbox/quote-image-test.js
canQuoteImagetocanBuildImageQuoteto-markdown-test.js
Update markdown conversion test expectationsfrontend/discourse/tests/unit/lib/to-markdown-test.js
.pngextension in upload:// URLs