Skip to content

Commit

Permalink
Merge pull request #3023 from projectblacklight/shellwords
Browse files Browse the repository at this point in the history
Escape bootstrap-version
  • Loading branch information
dkinzer committed Feb 25, 2023
2 parents 3afaa01 + f491661 commit d00b7b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/generators/blacklight/assets_generator.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

require 'shellwords'

module Blacklight
class AssetsGenerator < Rails::Generators::Base
class_option :'bootstrap-version', type: :string, default: ENV.fetch('BOOTSTRAP_VERSION', '~> 5.1'), desc: "Set the generated app's bootstrap version"

def run_asset_pipeline_specific_generator
generated_options = "--bootstrap-version='#{options[:'bootstrap-version']}'" if options[:'bootstrap-version']
generated_options = "--bootstrap-version='#{Shellwords.escape(options[:'bootstrap-version'])}'" if options[:'bootstrap-version']

generator = if defined?(Propshaft)
'blacklight:assets:propshaft'
Expand Down
4 changes: 3 additions & 1 deletion lib/generators/blacklight/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'shellwords'

module Blacklight
class Install < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
Expand Down Expand Up @@ -35,7 +37,7 @@ def add_solr_wrapper
# Call external generator in AssetsGenerator, so we can
# leave that callable seperately too.
def copy_public_assets
generated_options = "--bootstrap-version='#{options[:'bootstrap-version']}'" if options[:'bootstrap-version']
generated_options = "--bootstrap-version='#{Shellwords.escape(options[:'bootstrap-version'])}'" if options[:'bootstrap-version']

generate "blacklight:assets", generated_options unless options[:'skip-assets']
end
Expand Down

0 comments on commit d00b7b6

Please sign in to comment.