diff --git a/CHANGES.md b/CHANGES.md
index 6da5553f1..8dc23cc77 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -82,6 +82,7 @@
### Bug fixes
+- **Media filenames keep their punctuation** when inserted into an entry.
- **Changing a password ends the account's other sessions.** Saving a new
password in the profile, an administrator's reset, or disabling an account
now logs out that user's other browsers at their next Roller UI page; the
diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp
index d653aef15..4a1a62b7a 100644
--- a/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp
@@ -262,12 +262,14 @@
function onSelectMediaFile(name, url, isImage, hasThumbnail) {
$("#mediafile_edit_lightbox").modal("hide");
$("#mediaFileEditor").attr('src', 'about:blank');
+ var link = $('').attr('href', url);
if (isImage === "true") {
var src = hasThumbnail === "false" ? url : url + '?t=true';
- insertMediaFile('');
+ link.append($('
').attr({src: src, alt: name}));
} else {
- insertMediaFile('' + name + '');
+ link.text(name);
}
+ insertMediaFile(link.prop('outerHTML'));
}
diff --git a/it-selenium/src/test/java/org/apache/roller/selenium/editor/RichEditorContentIT.java b/it-selenium/src/test/java/org/apache/roller/selenium/editor/RichEditorContentIT.java
index c0e2d8992..922c5251a 100644
--- a/it-selenium/src/test/java/org/apache/roller/selenium/editor/RichEditorContentIT.java
+++ b/it-selenium/src/test/java/org/apache/roller/selenium/editor/RichEditorContentIT.java
@@ -19,10 +19,13 @@
package org.apache.roller.selenium.editor;
+import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.junit.AfterClass;
import org.junit.Before;
@@ -40,7 +43,7 @@
/**
* Runs the entry editor's rich-editor-content.js in a blank page in Firefox,
* without a Roller server: which entries open in the HTML textarea instead of
- * the rich editor, and where the textarea fallback inserts media files.
+ * the rich editor, and how media is inserted in the entry editor.
*
*
The module's verify phase starts Roller in Jetty first. To run just this
* class without it, from it-selenium:
@@ -162,6 +165,11 @@ public class RichEditorContentIT {
// the rich editor loads entries with jQuery's html()
private static final String JQUERY = "META-INF/resources/webjars/jquery/3.7.1/jquery.js";
+ private static final Pattern MEDIA_CHOOSER_CALLBACK =
+ Pattern.compile("(?ms)^ function onSelectMediaFile\\(.*?^ }");
+ private static final String MEDIA_NAME = "Notes ' \"