Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Don't allow trailing newlines in various checks. #2266
There's a subtle difference between what
/\Afoo\Z/.match("foo\n") # => #<MatchData "foo"> /\Afoo\Z/.match("foo\n\n") # => nil /\Afoo\z/.match("foo\n") # => nil
The current usage of
I've left the Cucumber steps alone as changing them makes adding the
Sorry! This totally slipped my mind.
Yes you're right that's where the risk lies in this pull request - though no tests fail and I haven't encountered any issues. I haven't exhaustively confirmed all the code paths that spit out mine types (in fact I haven't investigated any :p) but I think I'm right in saying that the change that could cause unexpected consequences is in the validation suggested to users in the README and not in the library itself - no wait, here's one.
Either way the rest of the changes are probably what was originally intended in that a subdomain or file path cannot include newlines - so this could prevent potentially difficult-to-debug user error (though I imagine nobody has ever encountered this!).