Skip to content

Commit

Permalink
Fixed security warnings, replace also multiple * with basename for ea…
Browse files Browse the repository at this point in the history
…ch *

    * brix11/lib/brix11/options.rb:
    * brix11/lib/brix11/project.rb:
  • Loading branch information
jwillemsen committed Jan 29, 2024
1 parent a1da999 commit 97a540b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion brix11/lib/brix11/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def has_key?(k)
def load(rcpath)
log(3, "Loading #{BRIX11RC} from #{rcpath}")
begin
_cfg = JSON.parse(IO.read(rcpath))
_cfg = JSON.parse(File.read(rcpath))
rescue JSON::ParserError => ex
log_fatal("Error parsing JSON file #{rcpath}: #{ex}")
end
Expand Down
4 changes: 2 additions & 2 deletions brix11/lib/brix11/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ def list_mpc_projects(path)
def parse_mpc_file(file)
base_name = File.basename(file, '.*')
ptable = {}
IO.foreach(file) do |ln|
File.foreach(file) do |ln|
if /\A\s*project\s*\((.*)\)/ =~ ln
convert = !ln.index('*').nil?
prj = $1.strip.sub(/\A\*\Z/, base_name)
prj.sub!(/\A\*/) { |_| base_name + '_' }
prj.sub!(/\*\Z/) { |_| '_' + base_name }
prj.sub!('*', "_#{base_name}_")
prj.gsub!('*', "_#{base_name}_")
prj.gsub!(/(\A|[^a-zA-Z0-9])?([a-zA-Z0-9])([a-zA-Z0-9]*)/) { |_| $1 + $2.upcase + $3 } if convert
ptable[prj] = file
end
Expand Down

0 comments on commit 97a540b

Please sign in to comment.