mirror of
https://github.com/bleackstorm/satiea.git
synced 2026-12-03 07:41:56 +01:00
refactor: optimize Firestore rules and meal cleanup
- Tighten Firestore validation rules (data size and limits) - Pass context to `deletePhotoFile` for safer file management - Cleanup unused dependencies in build configuration - Update Robolectric SDK target for tests
This commit is contained in:
1 parent
87bbb448c2
commit
79e04f64d8
28 files changed
+1606
-1230
No files matched your search
@@ -60,12 +60,20 @@ object CsvExporter {
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
private fun escapeCsvField(value: String): String {
|
||||
val sanitized = value.replace("\r\n", " ").replace("\n", " ").trim()
|
||||
return if (sanitized.contains(",") || sanitized.contains("\"") || sanitized.contains(";")) {
|
||||
"\"${sanitized.replace("\"", "\"\"")}\""
|
||||
fun escapeCsvField(value: String): String {
|
||||
val rawWithoutNewlines = value.replace("\r\n", " ").replace("\n", " ")
|
||||
val trimmed = rawWithoutNewlines.trim()
|
||||
val formulaProtected = if (rawWithoutNewlines.isNotEmpty() && rawWithoutNewlines[0] in listOf('=', '+', '-', '@', '\t', '\r')) {
|
||||
"'$rawWithoutNewlines"
|
||||
} else if (trimmed.isNotEmpty() && trimmed[0] in listOf('=', '+', '-', '@')) {
|
||||
"'$trimmed"
|
||||
} else {
|
||||
sanitized
|
||||
trimmed
|
||||
}
|
||||
return if (formulaProtected.contains(",") || formulaProtected.contains("\"") || formulaProtected.contains(";")) {
|
||||
"\"${formulaProtected.replace("\"", "\"\"")}\""
|
||||
} else {
|
||||
formulaProtected
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user