265
266
267
268
269
270
271
272
273
274
275
276
|
# File 'supply/lib/supply/uploader.rb', line 265
def upload_metadata(language, listing)
Supply::AVAILABLE_METADATA_FIELDS.each do |key|
path = File.join(metadata_path, language, "#{key}.txt")
listing.send("#{key}=".to_sym, File.read(path, encoding: 'UTF-8')) if File.exist?(path)
end
begin
listing.save
rescue Encoding::InvalidByteSequenceError => ex
message = (ex.message || '').capitalize
UI.user_error!("Metadata must be UTF-8 encoded. #{message}")
end
end
|