Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upinterpret empty data URI as plain text #7836
Conversation
| @@ -69,8 +72,23 @@ fn plain_charset() { | |||
| } | |||
|
|
|||
| #[test] | |||
| fn plain_only_charset() { | |||
| assert_parse( | |||
| "data:charset=utf-8,hello", | |||
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 2, 2015
Contributor
The correct shorthand is data:;charset=utf-8,hello. data:charset=utf-8,<b>hello gets interpreted as HTML by Firefox.
| assert_parse("data:,hello%20world", None, None, Some(b"hello world".iter().map(|&x| x).collect())); | ||
| assert_parse( | ||
| "data:,hello%20world", | ||
| Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec!()))), |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 2, 2015
Contributor
This should be Some(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec!((Attr::Charset, Value::Ext("US-ASCII".to_owned()))))), or something like that.
|
-S-awaiting-review +S-needs-squash This looks good to me. Added one minor/optional style comment. After addressing that (if you choose), please rebase and squash all the commits, and this can land with r=mbrubeck. Thanks! Reviewed 2 of 2 files at r1, 2 of 2 files at r3. components/net/data_loader.rs, line 64 [r1] (raw file): Comments from the review on Reviewable.io |
change `data:charset=` to `data:;charset=` and set US-ASCII as default encoding style change
|
I think I did the right thing. I'm still getting used to git. |
|
Reviewed 1 of 1 files at r4. Comments from the review on Reviewable.io |
|
@bors-servo r+ Looks great, thanks! |
|
|
interpret empty data URI as plain text Fixes #7803. As @eefriedman pointed out, RFC 2397 says: > If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII. As a shorthand, "text/plain" can be omitted but the charset parameter supplied. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7836) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
|
|
|
|
6112 commentedOct 2, 2015
Fixes #7803. As @eefriedman pointed out, RFC 2397 says: