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

Allow whitespace before protocols. #126

Merged
merged 1 commit into from
Dec 12, 2014

Conversation

benubois
Copy link
Contributor

Hi @rgrove,

Thanks for an excellent library!

I recently received a bug report on Feedbin about a broken image. The source in the XML looked like:

<img src="
http://img.thedailywtf.com/images/14/q4/e141/Pic-2.png" />

But after it was sanitized it looked like:

<img>

It appears that any attribute that is checked for a valid protocol will be stripped if it contains leading whitespace.

Not sure if this is the right place to address this. The other idea I had was to allow for a regex when specifying allowed protocols like:

protocols: {
  'img' => {'src' => [/\A\s*http/i]}
}

@rgrove rgrove merged commit 5595646 into rgrove:master Dec 12, 2014
@rgrove
Copy link
Owner

rgrove commented Dec 12, 2014

@benubois Thanks! I've merged and released 3.0.4 with this fix.

I'm a huge Feedbin fan, btw. Had no idea you were using Sanitize. :)

@benubois
Copy link
Contributor Author

Excellent! Happy to hear you're a Feedbin fan.

Yeah, sanitize is perfect for safely displaying content from an RSS feed 😄

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

Successfully merging this pull request may close these issues.

2 participants