bulkrax 3.1.1 → 3.1.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
  SHA256:
3
- metadata.gz: 41dde3161532c80ff433be4697fa6c42f0f453dfea3547181c44914a68e3b466
4
- data.tar.gz: 67473e62b537f71aa77aa664c361ba1e86c60e77451e4813a44597a9f465010b
3
+ metadata.gz: d1738f148a6fe4a7a4bc3b97a39e08169f04540c9814dc1ba6c4c14350591440
4
+ data.tar.gz: 995db6ebd622ccef4fe95c73e240b85bd3e303f9a00fe164c95f602b96c694b2
5
5
  SHA512:
6
- metadata.gz: 3859148384111048a2a2c096cee9bde5a9c78cb8e5a73b5ddb1d31c3ddefe7a221d1ebff97e3b1f96f09e746ac60b3ec1c14e615ef162fe1a5e16f883a3a7ecf
7
- data.tar.gz: bbc83265d59d5026546e6e92ccab3b93d6d4bf35ae08145ab6b27112ed587449572d763fdf3d876ec391dfce43d8b5fa96154e8507053ff2fac7b81bc2409580
6
+ metadata.gz: e5d7c2dfc70ddd26c80c51e580a2fb9b067cd3752df172066d68e26d0a6c5e7aa593a3779d9dad99e7d344fb632a723a13e8c663a2cf944e3bd491d3071bcc21
7
+ data.tar.gz: 5408270ea11b4d1d185daaf266d9de8a16a11b27777e45c9443ab6de9fb02600c1899ac08fd57267c909fe1584fb7a32fbf9b628086157ce39bbbcf2824fe646
@@ -49,13 +49,11 @@ module Bulkrax
49
49
  reschedule({ parent_identifier: parent_identifier, importer_run_id: importer_run_id })
50
50
  return false # stop current job from continuing to run after rescheduling
51
51
  end
52
- importer_id = ImporterRun.find(importer_run_id).importer_id
53
52
  @parent_entry ||= Bulkrax::Entry.where(identifier: parent_identifier,
54
- importerexporter_id: importer_id,
53
+ importerexporter_id: ImporterRun.find(importer_run_id).importer_id,
55
54
  importerexporter_type: "Bulkrax::Importer").first
56
55
  create_relationships
57
56
  pending_relationships.each(&:destroy)
58
- Bulkrax::Importer.find(importer_id).record_status
59
57
  rescue ::StandardError => e
60
58
  parent_entry ? parent_entry.status_info(e) : child_entry.status_info(e)
61
59
  Bulkrax::ImporterRun.find(importer_run_id).increment!(:failed_relationships) # rubocop:disable Rails/SkipsModelValidations
@@ -12,7 +12,7 @@ module Bulkrax
12
12
  # check for our entry in our current importer first
13
13
  importer_id = ImporterRun.find(importer_run_id).importer_id
14
14
  default_scope = { identifier: identifier, importerexporter_type: 'Bulkrax::Importer' }
15
- record = Entry.find_by(default_scope, importerexporter_id: importer_id) || Entry.find_by(default_scope)
15
+ record = Entry.find_by(default_scope.merge({ importerexporter_id: importer_id })) || Entry.find_by(default_scope)
16
16
 
17
17
  # TODO(alishaevn): discuss whether we are only looking for Collection models here
18
18
  # use ActiveFedora::Base.find(identifier) instead?
@@ -42,19 +42,22 @@ module Bulkrax
42
42
  end
43
43
  end
44
44
 
45
- # Prepend the file_set id to ensure a unique filename
45
+ # Prepend the file_set id to ensure a unique filename and also one that is not longer than 255 characters
46
46
  def filename(file_set)
47
47
  return if file_set.original_file.blank?
48
48
  fn = file_set.original_file.file_name.first
49
49
  mime = Mime::Type.lookup(file_set.original_file.mime_type)
50
50
  ext_mime = MIME::Types.of(file_set.original_file.file_name).first
51
51
  if fn.include?(file_set.id) || importerexporter.metadata_only?
52
- return fn if mime.to_s == ext_mime.to_s
53
- return "#{fn}.#{mime.to_sym}"
52
+ filename = "#{fn}.#{mime.to_sym}"
53
+ filename = fn if mime.to_s == ext_mime.to_s
54
54
  else
55
- return "#{file_set.id}_#{fn}" if mime.to_s == ext_mime.to_s
56
- return "#{file_set.id}_#{fn}.#{mime.to_sym}"
55
+ filename = "#{file_set.id}_#{fn}.#{mime.to_sym}"
56
+ filename = "#{file_set.id}_#{fn}" if mime.to_s == ext_mime.to_s
57
57
  end
58
+ # Remove extention truncate and reattach
59
+ ext = File.extname(filename)
60
+ "#{File.basename(filename, ext)[0...(255 - ext.length)]}#{ext}"
58
61
  end
59
62
  end
60
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bulkrax
4
- VERSION = '3.1.1'
4
+ VERSION = '3.1.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -384,7 +384,7 @@ homepage: https://github.com/samvera-labs/bulkrax
384
384
  licenses:
385
385
  - Apache-2.0
386
386
  metadata: {}
387
- post_install_message:
387
+ post_install_message:
388
388
  rdoc_options: []
389
389
  require_paths:
390
390
  - lib
@@ -399,8 +399,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
399
  - !ruby/object:Gem::Version
400
400
  version: '0'
401
401
  requirements: []
402
- rubygems_version: 3.1.4
403
- signing_key:
402
+ rubygems_version: 3.0.3
403
+ signing_key:
404
404
  specification_version: 4
405
405
  summary: Import and export tool for Hyrax and Hyku
406
406
  test_files: []