Skip to content

Commit 59f83e2

Browse files
committed
fix(codaveri): use base64 for all supporting files for Java
This rule of using only base64 encoding for supporting files should apply to all compiled languages like Java, C, C++
1 parent a4bc833 commit 59f83e2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

app/services/course/assessment/question/programming_codaveri/java/java_package_service.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,10 @@ def extract_supporting_file(filename, content)
108108

109109
supporting_file_object[:type] = 'internal' # 'external' s3 upload not yet implemented by codaveri
110110
supporting_file_object[:path] = filename.to_s
111-
if content.force_encoding('UTF-8').valid_encoding?
112-
supporting_file_object[:content] = content
113-
supporting_file_object[:encoding] = 'utf8'
114-
else
115-
supporting_file_object[:content] = Base64.strict_encode64(content)
116-
supporting_file_object[:encoding] = 'base64'
117-
end
111+
# TODO: re-implement content.force_encoding('UTF-8').valid_encoding? check
112+
# Pending Codaveri 'utf8' encoding support for compiled languages
113+
supporting_file_object[:content] = Base64.strict_encode64(content)
114+
supporting_file_object[:encoding] = 'base64'
118115

119116
@data_files.append(supporting_file_object)
120117
end

0 commit comments

Comments
 (0)