lib/gitlab_git/repository.rb in gitlab_git-10.4.4 vs lib/gitlab_git/repository.rb in gitlab_git-10.4.5

- old
+ new

@@ -950,10 +950,13 @@ # Create the info directory if needed Dir.mkdir(info_dir_path) unless File.directory?(info_dir_path) # Write the contents of the .gitattributes file to info/attributes - File.write(info_attributes_path, gitattributes_content) + # Use binary mode to prevent Rails from converting ASCII-8BIT to UTF-8 + File.open(info_attributes_path, "wb") do |file| + file.write(gitattributes_content) + end end # Checks if the blob should be diffable according to its attributes def diffable?(blob) blob_attributes = attributes(blob.path).to_h