id3tag 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c0b821b5377f22089bdda01eae4e3b4a77e8ab2
4
- data.tar.gz: 698cbb6e33de5bd8ea628521ada68ec1a2b94b18
3
+ metadata.gz: 30e2c415fd1a952d8239e96cf5b2ece8f3729f23
4
+ data.tar.gz: 9e064e792b74db5d5d473f04d7caa7865ff789f7
5
5
  SHA512:
6
- metadata.gz: 732fad51cb94e0e4ebe55d0221515ea098084e61b2c9b95415b484cd1808a00e010c86cee9ddb5c38e0d196f81361c327d9bc1a859153698535b43991944d334
7
- data.tar.gz: cdf7eb252dac30f582483b994d30f9effcd0ecf1aa9606892220fa838c758466d4c84a374436b963a60c908c631de4c1849eb2047ac73c45e275fd66f71b0b86
6
+ metadata.gz: c77daedfe027a064210ccd201f78e8834f6fdec4efd8bca7b0b34fe2e2329e9a3bb42fc1a8ae2a5f926cfc636ee3941f61a399d8cd8e48e41922ca8c714e886d
7
+ data.tar.gz: 11341ffed291bf7aab6441587461eadec753c454bad13d43bf4427212f86c4a8156e5e170635b771f82983e448c0558e4939278a76e96ce3a571fb89462fb70e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/id3tag.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: id3tag 0.3.1 ruby lib
5
+ # stub: id3tag 0.3.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "id3tag"
9
- s.version = "0.3.1"
9
+ s.version = "0.3.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Krists Ozols"]
@@ -13,7 +13,7 @@ module ID3Tag
13
13
  end
14
14
 
15
15
  def text
16
- @text ||= encoded_text_and_content_parts.last
16
+ @text ||= cut_at_null_byte(encoded_text_and_content_parts.last)
17
17
  end
18
18
 
19
19
  def content
@@ -12,11 +12,15 @@ module ID3Tag
12
12
  }
13
13
 
14
14
  def content
15
- @content ||= content_without_encoding_byte.encode(destination_encoding, source_encoding)
15
+ @content ||= cut_at_null_byte(content_without_encoding_byte.encode(destination_encoding, source_encoding))
16
16
  end
17
17
 
18
18
  alias inspectable_content content
19
19
 
20
+ def cut_at_null_byte(string)
21
+ string.split(NULL_BYTE, 2).first
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def source_encoding
@@ -20,6 +20,13 @@ describe ID3Tag::Frames::V2::TextFrame do
20
20
  describe '#content' do
21
21
  subject { frame.content }
22
22
 
23
+ context "when text's last char is null byte" do
24
+ let(:target_encoding) { Encoding::UTF_8 }
25
+ let(:encoding_byte) { "\x03" }
26
+ let(:text) { "Glāzšķūņrūķīši\x00" }
27
+ it { should == 'Glāzšķūņrūķīši' }
28
+ end
29
+
23
30
  context "when encoding byte is not present" do
24
31
  let(:encoding_byte) { "" }
25
32
  it { expect { subject }.to raise_error(ID3Tag::Frames::V2::TextFrame::UnsupportedTextEncoding) }
data/tags CHANGED
@@ -126,6 +126,7 @@ convert_string_to_32bit_integer lib/id3tag/number_util.rb /^ def self.convert
126
126
  current_additional_info_map lib/id3tag/frames/v2/frame_flags.rb /^ def current_additional_info_map$/;" f class:ID3Tag.Frames.V2.FrameFlags
127
127
  current_encoding_map lib/id3tag/frames/v2/text_frame.rb /^ def current_encoding_map$/;" f class:ID3Tag.Frames.V2.TextFrame
128
128
  current_flag_map lib/id3tag/frames/v2/frame_flags.rb /^ def current_flag_map$/;" f class:ID3Tag.Frames.V2.FrameFlags
129
+ cut_at_null_byte lib/id3tag/frames/v2/text_frame.rb /^ def cut_at_null_byte(string)$/;" f class:ID3Tag.Frames.V2.TextFrame
129
130
  data_length_indicator? lib/id3tag/frames/v2/basic_frame.rb /^ def data_length_indicator?$/;" f class:ID3Tag.Frames.V2.BasicFrame
130
131
  data_length_indicator? lib/id3tag/frames/v2/frame_flags.rb /^ def data_length_indicator?$/;" f class:ID3Tag.Frames.V2.FrameFlags
131
132
  decode lib/id3tag/synchsafe_integer.rb /^ def decode(synchsafe_int)$/;" f class:ID3Tag.SynchsafeInteger.encode
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id3tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krists Ozols