Skip to content

Ascii being returned from API #89

@Josiassejod1

Description

@Josiassejod1
Bugsnag: URI must be ascii only "https://api.unsplash.com/photos/a-castle-with-many-spires-with-pele\u0219-castle-in-the-background-Grnf3_TTUjo"
    gems/uri-1.1.1/lib/uri/rfc3986_parser.rb:84 in `URI::RFC3986_Parser#split`
    gems/uri-1.1.1/lib/uri/rfc3986_parser.rb:135 in `URI::RFC3986_Parser#parse`
    gems/uri-1.1.1/lib/uri/common.rb:247 in `URI.parse`
    gems/unsplash-3.1.1/lib/unsplash/client.rb:45 in `Unsplash::Client#add_utm_params`
    gems/unsplash-3.1.1/lib/unsplash/client.rb:58 in `block in Unsplash::Client#add_utm_to_links`
    gems/unsplash-3.1.1/lib/unsplash/client.rb:57 in `Hash#each`
    gems/unsplash-3.1.1/lib/unsplash/client.rb:57 in `Unsplash::Client#add_utm_to_links`
    gems/unsplash-3.1.1/lib/unsplash/client.rb:10 in `Unsplash::Client#initialize`
    gems/unsplash-3.1.1/lib/unsplash/photo.rb:7 in `Unsplash::Photo#initialize`
    gems/unsplash-3.1.1/lib/unsplash/search.rb:12 in `Class#new`
    ...and 116 more stack frames
  Analytics Event
  # @private
    def add_utm_params(url)
      uri = URI.parse(url) ❌

      qs = Rack::Utils.parse_nested_query(uri.query)
      qs.merge!(connection.utm_params)

      uri.query = Rack::Utils.build_query(qs)

      uri.to_s
    end

If a photo url has ascii in the name, this will fail in the gem. I fixed this change in #90.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions