6174 / 6174/pagedown

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

Open
#83 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
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 =
/^(]*")?(\stitle="[^"<>]*")?\s?\/?>)$/
i;

```

Original issue reported on code.google.com by `gareth.r...@gmail.com` on 28 Jan 2015 at 12:30

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.