diff options
author | Benjamin Fleischer <benjamin.fleischer@swipesense.com> | 2016-05-12 14:21:07 -0500 |
---|---|---|
committer | Benjamin Fleischer <github@benjaminfleischer.com> | 2016-09-05 18:05:37 -0500 |
commit | 2495a0ba33832d20e3eadc163999dd40123e10c1 (patch) | |
tree | ba29d314615e9a171bbc83f81ea92f59864b2eb4 /railties | |
parent | da33612d0ffd7750b4caebbaeeb9bc2635c14a12 (diff) | |
download | rails-2495a0ba33832d20e3eadc163999dd40123e10c1.tar.gz rails-2495a0ba33832d20e3eadc163999dd40123e10c1.tar.bz2 rails-2495a0ba33832d20e3eadc163999dd40123e10c1.zip |
Extract notes from files in binary
Prevents:
ArgumentError: invalid byte sequence in UTF-8
railties/lib/rails/source_annotation_extractor.rb:115:in `=~'
railties/lib/rails/source_annotation_extractor.rb:115:in `block in extract_annotations_from'
And there's no reason we need to interpret the files as UTF-8
when scanning for annotations.
Applies to Rails 4.2 as well.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/source_annotation_extractor.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index f0df76d3f3..c60e59cb88 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -116,7 +116,7 @@ class SourceAnnotationExtractor # Otherwise it returns an empty hash. def extract_annotations_from(file, pattern) lineno = 0 - result = File.readlines(file).inject([]) do |list, line| + result = File.readlines(file, encoding: Encoding::BINARY).inject([]) do |list, line| lineno += 1 next list unless line =~ pattern list << Annotation.new(lineno, $1, $2) |