Method: Qti::Models::Base#remap_href_path
- Defined in:
- lib/qti/models/base.rb
#remap_href_path(href) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/qti/models/base.rb', line 66 def remap_href_path(href) return nil unless href path = File.join(File.dirname(@path), href) if @package_root.nil? raise Qti::ParseError, "Potentially unsafe href '#{href}'" if href.split('/').include?('..') else unless Pathname.new(path).cleanpath.to_s.start_with?(@package_root) raise Qti::ParseError, "Unsafe href '#{href}'" end end path end |