~singpolyma/dhall-ruby

4752d63b5c7c691dad61879261066df204370432 — Stephen Paul Weber 5 years ago dd5013b
Standard reader requires UTF-8

To disable heuristics, force remote content to be UTF-8 text.
1 files changed, 13 insertions(+), 1 deletions(-)

M lib/dhall/resolve.rb
M lib/dhall/resolve.rb => lib/dhall/resolve.rb +13 -1
@@ 63,6 63,18 @@ module Dhall
			end
		end

		StandardReadHttpSources = lambda do |sources, parent_origin|
			ReadHttpSources.call(sources, parent_origin).map do |source_promise|
				source_promise.then do |s|
					s = s.force_encoding("UTF-8")
					unless s.valid_encoding?
						raise ImportFailedException, "#{s.inspect} is not valid UTF-8"
					end
					s
				end
			end
		end

		RejectSources = lambda do |sources|
			sources.map do |source|
				Promise.new.reject(ImportBannedException.new(source))


@@ 162,7 174,7 @@ module Dhall
		class Standard
			def initialize(
				path_reader: ReadPathSources,
				http_reader: ReadHttpSources,
				http_reader: StandardReadHttpSources,
				https_reader: http_reader
			)
				@path_resolutions = ResolutionSet.new(path_reader)