in edu-format/src/com/jetbrains/edu/learning/courseFormat/EduFile.kt [76:100]
fun getTextToSerialize(): String? {
if (this !is TaskFile || !task.course.needWriteYamlText) {
return null
}
// first, do not serialize binary contents
if (contents is BinaryContents) return null
if (contents is UndeterminedContents) {
// fallback to the legacy file way to determine binarity
val contentType = mimeFileType(name)
if (contentType != null && isBinary(contentType)) return null
}
val text = contents.textualRepresentation
if (exceedsBase64ContentLimit(text)) {
LOG.warning(
"Base64 encoding of `$name` file exceeds limit (${getBinaryFileLimit().toLong()}), " +
"its content isn't serialized"
)
return null
}
return text
}