Skip to content

Commit

Permalink
Merge fa30861 into fa6ed60
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Nov 17, 2017
2 parents fa6ed60 + fa30861 commit cb8305a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ notifications:
- "irc.freenode.org#scholarsphere"
template:
- "%{repository}//%{branch}@%{commit} by %{author}: %{message} - %{build_url}"
addons:
apt:
sources:
- "trusty-media"
- sourceline: ppa:jonathonf/ffmpeg-3
packages:
- ghostscript
- ufraw-batch
- libpng-dev
- imagemagick
- ffmpeg
- libreoffice
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace :derivatives do
end

RSpec::Core::RakeTask.new(:rspec) do |task|
task.rspec_opts = "--tag ~requires_imagemagick --tag ~requires_ffmpeg --tag ~requires_libreoffice --tag ~requires_kdu_compress" if ENV['TRAVIS']
task.rspec_opts = "--tag ~requires_kdu_compress" if ENV['TRAVIS']
end

desc 'Start up Solr & Fedora and run tests'
Expand Down
6 changes: 6 additions & 0 deletions config/fcrepo_wrapper_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
port: null
verbose: true
managed: true
enable_jms: false
fcrepo_home_dir: tmp/fcrepo4-test-data
version: 4.7.4
2 changes: 1 addition & 1 deletion lib/hydra/derivatives/runners/full_text_extract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class FullTextExtract < ImageDerivatives
# Adds format: 'txt' as the default to each of the directives
def self.transform_directives(options)
options.each do |directive|
directive.reverse_merge!(format: 'txt')
directive.reverse_merge!(format: 'txt', binary: false)
end
options
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def self.retrieve_remote_file(directives)
# @param [Hash] directives directions which can be used to determine where to persist to.
# @return [Hydra::Derivatives::IoDecorator]
def self.io(content, directives)
Hydra::Derivatives::IoDecorator.new(content, new_mime_type(directives.fetch(:format), charset(content)))
charset = charset(content) if directives[:format] == 'txt' || !directives.fetch(:binary, true)
Hydra::Derivatives::IoDecorator.new(content, new_mime_type(directives.fetch(:format), charset))
end
private_class_method :io

Expand Down
2 changes: 1 addition & 1 deletion spec/units/transcoding_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def create_derivatives(_filename)
expect(file.attached_files['original_file_thumb']).to have_content
expect(file.attached_files['original_file_thumb'].mime_type).to eq('image/png')
expect(file.attached_files['fulltext'].content).to match(/This PDF file was created using CutePDF/)
expect(file.attached_files['fulltext'].mime_type).to eq 'text/plain'
expect(file.attached_files['fulltext'].mime_type).to eq 'text/plain;charset=UTF-8'
end
end

Expand Down

0 comments on commit cb8305a

Please sign in to comment.