Export to GitHub

digg - issue #5

oEmbed discovery -- support entities and whitespace


Posted on Sep 1, 2009 by Quick Kangaroo

I have an oEmbed disovery URL listed in http://ohnopub.net/pix/?id=6215 . All of http://ohnopub.net/pix/ is reformatted by tidy for readability and slight insurance of conformance. This causes the <link /> elements to be split across multiple lines:

`` <link rel="alternate" type="text/xml+oembed" href=

"http://ohnopub.net/pix/oembed.php?url=http%3A%2F%2Fohnopub.net%2Fpix%2F%3Fid%3D6215&amp;format=xml&quot; title="phppix" /> ''

The regex of Services_oEmbed does not support whitespace between attribute names and values. I am not sure where it is valid to have whitespace: maybe whitespace is allowed between href'' and=''? But I do know that whitespace is allowed after the equal sign and before the value because of Tidy's output and http://validator.w3.org/'s approval of my content.

Also, it seems that Services_oEmbed cannot handle the ``&amp;'' XML/HTML entity in the href= attribute. Use of this entity is necessary for the page to be loaded as XML/XHTML.

I have fixed both at http://git.ohnopub.net/services_oembed.git . I have some PHP code that tests my modifications attached. I'm not sure how to properly use services_oembed -- I can't really easily test the whole chunk of code, but I extracted the parts which I modified into the attached file.

Attachments

Comment #1

Posted on Sep 2, 2009 by Grumpy Cat

Whitespace is valid before and after = in HTML. I believe the proper solution is to subtly modify the regex's. I've done this in the laconica/statusnet bundled copy of Services_oEmbed. http://gitorious.org/laconica/mainline/commit/29d0dd740c329c2674de58bec172419148a1b495 : Allow whitespace before and after the = and require space before the href in html

Status: New

Labels:
Type-Defect Priority-Medium