Skip to content

Use double-quoted attributes in media file links inserted into new entries - #159

Closed
mraible wants to merge 1 commit into
masterfrom
fix-media-file-link-markup
Closed

mraible wants to merge 1 commit into
masterfrom
fix-media-file-link-markup

Conversation

@mraible

@mraible mraible commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The "create a post from your uploaded files" flow builds its image and enclosure markup with single-quoted attributes and an invalid closing tag, and the resulting image does not render after publishing. The media chooser on the entry editor inserts the same link with double quotes and a self-closing img tag, and that form works, so this flow now matches it.

Reported by Greg Huber on dev@roller while testing the ROL-2183 branch; the bug exists on master independently of that work.

…w entries

The "create a post from your uploaded files" flow built its image and enclosure markup with single-quoted attributes and an invalid closing </img> tag, and the resulting image did not render after publishing. The media chooser on the entry editor already inserts the same link with double quotes and a self-closing img tag, and that form works, so this flow now matches it. Reported by Greg Huber on dev@roller.
@mraible
mraible force-pushed the fix-media-file-link-markup branch from d737206 to 10d9cea Compare August 13, 2026 12:41
if (mediaFile.isImageFile()) {
link = "<p>" + mediaFile.getName() + "</p>";
link += "<a href='<url>'><img src='<urlt>' alt='<name>' width='<width>' height='<height>'></img></a>";
link += "<a href=\"<url>\"><img src=\"<urlt>\" alt=\"<name>\" width=\"<width>\" height=\"<height>\" /></a>";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so the fix is the missing / of this line and the quote change is to match other generated code? I see usage of both href=' and href=" but double quote is more common so thats good.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Close. There are two changes on that line, and together they make the markup identical to what the entry editor's media chooser inserts, which is the path that renders correctly:

  • </img> becomes a self-closing />, since img is a void element and the closing tag is invalid. That's the / you spotted.
  • The attributes switch from single to double quotes, which also matches the other generated markup.

I changed both together to match the working path, so I can't say which of the two broke rendering on its own.

@snoopdave

Copy link
Copy Markdown
Contributor

I think this is superceded by #193. Please re-open if I am wrong about that.

@snoopdave snoopdave closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants