lib/jsom/pagination/links.rb in jsom-pagination-0.1.2 vs lib/jsom/pagination/links.rb in jsom-pagination-0.1.3

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'rack' - +require 'rack/utils' +require 'addressable' module JSOM module Pagination class Links DEFAULT_PAGE_SIZE = 20 @@ -37,10 +37,11 @@ @total_pages = total_pages generate_links end def parse_url(url) - uri = URI.parse(URI.unescape(url)) + uri = Addressable::URI.parse(url) + url_params = Rack::Utils.parse_nested_query( uri.query ).delete_if { |key, _value| key == 'page' } uri.query = to_query(url_params) uri.query = nil if uri.query.empty?