Skip to content
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

sanitizeHtml() stripping images with apostrophes in URL - Regex modification required #83

Open
GoogleCodeExporter opened this issue Sep 1, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
======================================

1. Attempting to insert an image with an apostrophe in the URL e.g:

https://d3sn47bls4ur42.cloudfront.net/20150028/a6021aa6-0500-2d55-b9e6-d14ce9cc7
73c/parisian-austrian-jeweller's-shop-wrecked-after-outbreak-of-war.jpg

The function sanitizeHtml in Markdown.Santitizer.js uses a regex pattern which 
does not permit apostrophes. This causes images with such URLs to be stripped 
from preview.

What is the expected output? What do you see instead?
=====================================================

Preview HTML stripped of images.

What version of the product are you using? On what operating system?
====================================================================

Tested against regex as in use today (2015/01/28), commit 2a8c75ce3fb5 I 
believe (though the full product version I am using is older)

Please provide any additional information below.
===============================================

Changing img_white variable to below fixes the issue (apostrophe included after 
0-9 in regex pattern).

var img_white = 
/^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9'+&@#\/%?=~_|!:,.;\(\)*[\]$]+"(\swidth=
"\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/
i;

Original issue reported on code.google.com by [email protected] on 28 Jan 2015 at 12:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant