Closed miyagawa closed 10 years ago
I'm all for avoiding a runtime error but can you give a stronger rationale for accepting unquoted attributes? They should be quoted, right?
No, it doesn't need to be, per I-D you quote in the readme and RFC 5988 as well: http://www.rfc-editor.org/rfc/rfc5988.txt
link-extension = token [ "=" ( token | quoted-string ) ]
Actually, the scanner regexp you already setup is coded to accept unquoted :) it just throws errors like described above, when that match happens.
ATTR = /#{TOKEN} *= *(#{TOKEN}|#{QUOTED}) */ #:nodoc:
Fair enough. I'll merge the request right away. I won't be able to publish a new gem for at least a few days though.
Out of curiousity, I'd love to know what you're using it for if you're able to share. You can email me at mjb@asplake.co.uk if you'd rather not do it here. Thanks!
I use it to ... parse Link headers in the API in tests, just like what it's designed for :)
:-)
Mike Burrows mjb@asplake.co.uk http://positiveincline.com http://positiveincline.com/index.php/about/ http://twitter.com/asplake +44 7785 236497
On 4 December 2013 14:40, Tatsuhiko Miyagawa notifications@github.comwrote:
I use it to ... parse Link headers in the API in tests, just like what it's designed for :)
— Reply to this email directly or view it on GitHubhttps://github.com/asplake/link_header/pull/4#issuecomment-29809537 .
Gem released also.
The scanner was already setup to match the pattern, but there's an unnecessary gsub call in case of the match and caused runtime error such as:
This patch moves the gsub to only run in case of quoted match.