Skip to content

fix(image-render): match image embeds based on file extension in url #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-terms-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@miniapps/image-render": patch
---

fix: match image embeds based on file extension in url
10 changes: 9 additions & 1 deletion miniapps/image-render/src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ const manifest: ModManifest = {
if: {
value: "{{embed.url}}",
match: {
equals: "{{embed.metadata.image.url}}",
OR: [
{ equals: "{{embed.metadata.image.url}}" },
{ endsWith: ".png" },
{ endsWith: ".jpg" },
{ endsWith: ".jpeg" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about .webp?

How are we handling when theres no file extension but the content type has an image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add .webp

If there is no file extension and the open-graph API recognizes that the endpoint has an image it will be matched by embed.metadata.image.url. #16 also adds a mimeType attribute to the UrlMetadata type so we can match that too when it's merged.

Copy link
Contributor

@davidfurlong davidfurlong Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok - how do you want to go about the two PRs interdependence? happy with whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine to merge this now and open a new PR with the mimeType change when it's available. This should handle the vast majority of cases fine in the meantime

{ endsWith: ".gif" },
{ endsWith: ".svg" },
{ endsWith: ".webp" },
],
},
},
element: view,
Expand Down