Skip to content

Commit

Permalink
fix column name bug - bump version to 4.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
infused committed Jan 22, 2024
1 parent 7d3c0a0 commit 44f8bf7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.3.1

- Fix bug (since 4.2.0) that caused column names not to be truncated after null character

## 4.3.0

- Drop support for Ruby versions older than 3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/dbf/column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def underscored_name
private

def clean(value) # :nodoc:
value.strip.delete("\x00").gsub(/[^\x20-\x7E]/, '')
value.strip.partition("\x00").first.gsub(/[^\x20-\x7E]/, '')
end

def encode(value, strip_output: false) # :nodoc:
Expand Down
2 changes: 1 addition & 1 deletion lib/dbf/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DBF
VERSION = '4.3.0'.freeze
VERSION = '4.3.1'.freeze
end
4 changes: 2 additions & 2 deletions spec/dbf/column_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@
describe '#name' do
it 'contains only ASCII characters' do
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80--", 'N', 1, 0
expect(column.name).to eq '---hello world---'
expect(column.name).to eq '---hello '
end

it 'is truncated at the null character' do
column = DBF::Column.new table, "--\x1F-\x68\x65\x6C\x6C\x6F \x00world-\x80\x80--", 'N', 1, 0
expect(column.name).to eq '---hello world---'
expect(column.name).to eq '---hello '
end
end
end

0 comments on commit 44f8bf7

Please sign in to comment.