app/models/wp_item.rb in wpscan-3.7.5 vs app/models/wp_item.rb in wpscan-3.7.6

- old
+ new

@@ -21,11 +21,11 @@ # @param [ Hash ] opts # @option opts [ Symbol ] :mode The detection mode to use # @option opts [ Hash ] :version_detection The options to use when looking for the version # @option opts [ String ] :url The URL of the item def initialize(slug, blog, opts = {}) - @slug = URI.decode(slug) + @slug = Addressable::URI.unencode(slug) @blog = blog @uri = Addressable::URI.parse(opts[:url]) if opts[:url] @detection_opts = { mode: opts[:mode] } @version_detection_opts = opts[:version_detection] || {} @@ -81,23 +81,18 @@ else false end end - # URI.encode is preferered over Addressable::URI.encode as it will encode - # leading # character: - # URI.encode('#t#') => %23t%23 - # Addressable::URI.encode('#t#') => #t%23 - # # @param [ String ] path Optional path to merge with the uri # # @return [ String ] def url(path = nil) return unless @uri return @uri.to_s unless path - @uri.join(URI.encode(path)).to_s + @uri.join(Addressable::URI.encode(path)).to_s end # @return [ Boolean ] def ==(other) self.class == other.class && slug == other.slug @@ -164,10 +159,10 @@ # @option params [ hash ] :get Request params for the GET # # @return [ Typhoeus::Response ] def head_and_get(path, codes = [200], params = {}) final_path = +@path_from_blog - final_path << URI.encode(path) unless path.nil? + final_path << path unless path.nil? blog.head_and_get(final_path, codes, params) end end end