diff --git a/files/assets/js/markdown.js b/files/assets/js/markdown.js index 7bd625f1aa..6e4039979d 100644 --- a/files/assets/js/markdown.js +++ b/files/assets/js/markdown.js @@ -54,7 +54,7 @@ marked.use({ const reDisableBeforeUnload = /^\/submit|^\/h\/[a-zA-Z0-9_\-]{3,20}\/submit/; const image_regex_extensions = document.getElementById('IMAGE_FORMATS').value.replaceAll(',', '|') -const regex_pattern = String.raw`(^|\s)(https:\/\/[\w\-.#&/=\?@%;+,:]{5,250}(\.|\?format=)(` + image_regex_extensions + String.raw`)((\?|&)[\w\-.#&/=\?@%;+,:]*)?)($|\s)` +const regex_pattern = String.raw`(^|\s)(https:\/\/[\w\-.#&/=\?@%;+,:]{5,250}(\.|\?format=)(` + image_regex_extensions + String.raw`)((\?|&)[\w\-.#&/=\?@%;+,:]*)?)(?=$|\s|<)` const compiled_regex = new RegExp(regex_pattern, "g"); const approved_embed_hosts = document.getElementById('approved_embed_hosts').value.replace("{'", "").replace("'}", "").split("', '") diff --git a/files/helpers/regex.py b/files/helpers/regex.py index e1f1e42290..86917d2a88 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -105,7 +105,7 @@ audio_regex_extensions = '|'.join(AUDIO_FORMATS) audio_sub_regex = re.compile(f'(?