-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
HTML::DocumentFragment.parse should be able to accept an IO object #2069
Comments
@sharvy This might be a good first issue! There shouldn't be any C coding necessary, and it should be straightforward to write a test based on the reproduction script above. I think the solution is basically something like what we have in the if tags.respond_to?(:read)
tags = if encoding.nil?
tags.read
else
tags.read(encoding: encoding)
end
end and I'd want to test both branches of that (with and without encoding specified). |
@flavorjones Thanks. Looks like a quick win. I'm on it. |
Previously an exception (TypeError: no implicit conversion of File into String) would be raised. Fixes: sparklemotion#2069
Previously an exception (TypeError: no implicit conversion of File into String) would be raised. Fixes: sparklemotion#2069
**What problem is this PR intended to solve?** Previously an exception (TypeError: no implicit conversion of File into String) would be raised. Fixes: #2069 **Have you included adequate test coverage?** Yes. **Does this change affect the behavior of either the C or the Java implementations?** No.
Describe the bug
HTML4::Document.parse
,HTML5::Document.parse
, andHTML5::DocumentFragment.parse
all accept IO objects.But
HTML4::DocumentFragment.parse
raises an unobvious exception when we do this.To Reproduce
emits:
Expected behavior
I'd like the
HTML4::DocumentFragment.parse
method(s) be able to handle an IO object, even if that means we just#read
the whole string into aString
.The text was updated successfully, but these errors were encountered: