You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS (Operating System) version: macOS 12.5.1 (Monterey)
Browser and browser version: Safari 16.0
Django version: 4.1.2
Martor version & theme: 1.6.14 with Bootstrap theme
Steps to reproduce
In Safari: In the Simple Form demo, just pasting a Youtube url in the markdown editor, renders an empty iframe.
As you can see, the the src parameter is set without the protocol string (https).
This works fine in Chrome (106.0.5249.103) and Firefox (v 105.0.3)
I know this is a bug report, but in case it helps, I made the following changes to the mdx_video.py file
In the extendMarkdown function, I changed the regular expression to capture the protocol along with the youtubeid parameter. So the code was change from r"([^(]|^)https?://www\.youtube\.com/watch\?\S*v=(?P<youtubeid>\S[^&/]+)"
TO r"([^(]|^)(?P<protocol>(https?))://www\.youtube\.com/watch\?\S*v=(?P<youtubeid>\S[^&/]+)"
TO the version below that just uses the protocol parameter
class Youtube(markdown.inlinepatterns.Pattern):
def handleMatch(self, m):
if self.ext.config["youtube_nocookie"][0]:
url = "{0}://www.youtube-nocookie.com/embed/{1}".format(m.group("protocol"), m.group("youtubeid"))
else:
url = "{0}://www.youtube.com/embed/{1}".format(m.group("protocol"), m.group("youtubeid"))
Finally, thank you so much for your work/plugin. It has been incredibly helpful. If you take pull requests, I'd be happy to make the changes for your review.
The text was updated successfully, but these errors were encountered:
Oh wow, thank you so much @Amartya for finding this issue.
I would really be happy if you're also being a contributor to make this plugin better.
Please do create your pull-request.
Details
Steps to reproduce
As you can see, the the src parameter is set without the protocol string (https).
This works fine in Chrome (106.0.5249.103) and Firefox (v 105.0.3)
I know this is a bug report, but in case it helps, I made the following changes to the mdx_video.py file
In the extendMarkdown function, I changed the regular expression to capture the protocol along with the youtubeid parameter. So the code was change from
r"([^(]|^)https?://www\.youtube\.com/watch\?\S*v=(?P<youtubeid>\S[^&/]+)"
TO
r"([^(]|^)(?P<protocol>(https?))://www\.youtube\.com/watch\?\S*v=(?P<youtubeid>\S[^&/]+)"
In the Youtube class, I changed the code from
TO the version below that just uses the protocol parameter
Finally, thank you so much for your work/plugin. It has been incredibly helpful. If you take pull requests, I'd be happy to make the changes for your review.
The text was updated successfully, but these errors were encountered: