Skip to content

Commit

Permalink
Remove dot (.) prefix from formats
Browse files Browse the repository at this point in the history
Some resources were set with the . prefix, e.g. .csv, this would cause prefix links to not show. So removing the . will enable previews again.
  • Loading branch information
kentsanggds committed Oct 20, 2022
1 parent 157a457 commit 6af46e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/datafile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(hash)
@start_date = hash["start_date"]
@created_at = hash["created_at"]
@updated_at = hash["updated_at"]
@format = hash["format"]&.strip&.upcase
@format = hash["format"]&.strip&.delete_prefix(".")&.upcase
@size = hash["size"]
@uuid = hash["uuid"]
end
Expand Down
7 changes: 7 additions & 0 deletions spec/models/datafile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@
expect(datafile.csv?).to be true
end
end

describe "#csv?" do
it 'returns true if datafile is ".csv "' do
datafile = build :datafile, format: ".csv "
expect(datafile.csv?).to be true
end
end
end
end

0 comments on commit 6af46e6

Please sign in to comment.