Skip to content

Commit

Permalink
Relaxing PURL validation rules on incoming IDs and making them config…
Browse files Browse the repository at this point in the history
…urable
  • Loading branch information
randalldfloyd committed Oct 16, 2023
1 parent 9f77f14 commit acc5a1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/purl_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def formats

private
FILESET_LOOKUPS = { FileSet => nil }.freeze
DEFAULT_WORK_PATTERN = /^[a-zA-Z\/]{0,}\w{2,}\d{3,}-{0,}\d{0,}$/.freeze
purl_regex = ESSI.config.dig(:essi, :purl_validation_regex) || '^[a-zA-Z\d\/-]{0,}$'
DEFAULT_WORK_PATTERN = /#{purl_regex}/.freeze
DEFAULT_WORK_LOOKUPS = Hyrax.config.registered_curation_concern_types.sort.map do |klass|
[klass.constantize, DEFAULT_WORK_PATTERN.dup]
end.to_h.freeze
Expand Down
1 change: 1 addition & 0 deletions config/essi_config.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ default: &default
kdu_compress_path: 'opj_compress' # set as kdu_compress or opj_compress, or '' to use ImageMagick
master_file_service_url: http://purl.dlib.indiana.edu/iudl/variations/master
purl_redirect_url: /concern/works/%s
purl_validation_regex: '^[a-zA-Z\d\/-]{0,}$'
skip_derivatives: false
derivatives_folder: 'staged_files'
derivatives_type_suffix: true
Expand Down
1 change: 1 addition & 0 deletions config/essi_config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ default: &default
kdu_compress_path: '' # set as kdu_compress or opj_compress, or '' to use ImageMagick
master_file_service_url: http://purl.dlib.indiana.edu/iudl/variations/master
purl_redirect_url: /concern/works/%s
purl_validation_regex: '^[a-zA-Z\d\/-]{0,}$'
skip_derivatives: false
derivatives_folder: 'staged_files'
derivatives_type_suffix: true
Expand Down

0 comments on commit acc5a1a

Please sign in to comment.