Skip to content

Commit

Permalink
Merge pull request #325 from roomorama/feature/encode-uri-kigo
Browse files Browse the repository at this point in the history
Encode Kigo image URLs
  • Loading branch information
Renato Mascarenhas authored Sep 12, 2016
2 parents 15eb664 + 078dc97 commit 43d3b51
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ how this file is formatted and how the process works.
### Added
- fee percentage for hosts on Web app on suppliers#show.

### Fixed
- Kigo property images with non-Latin characters

## [0.8.0] - 2016-09-08
### Added
- Kigo and KigoLegacy integration: metadata sync, calendar sync, quoting, booking, cancelling support.
Expand Down
4 changes: 2 additions & 2 deletions lib/concierge/suppliers/kigo/mappers/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def images(payload, _)
identifier = url.split('/').last
caption = image['PHOTO_COMMENTS']
Roomorama::Image.new(identifier).tap do |i|
i.url = ['https:', url].join
i.url = URI.encode(['https:', url].join)
i.caption = caption unless caption.strip.empty?
end
end
end

end
end
end
14 changes: 13 additions & 1 deletion spec/lib/concierge/suppliers/kigo/mappers/resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@

expect(images.first.caption).to be_nil
end

it 'creates a valid image if the URL contains non-Latin characters' do
image['PHOTO_ID'] = '//dx577khz83dc.cloudfront.net/3304/P307_13_baño2_s.jpg'

images = subject.images([image], property_id)
expect(images.size).to eq 1

image = images.first
expect {
image.validate!
}.not_to raise_error
end
end

end
end

0 comments on commit 43d3b51

Please sign in to comment.