mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-21 11:00:06 +01:00
Fix editing previously exported notes not working properly
OutputStream for existing files with "content://" path needs to be opened in truncate mode, its description: "If the file already exists and is a regular file and is opened for writing, it will be truncated to length 0." Streams for files with "/storage" don't seem to be affected by this issue and don't need the truncate mode. See more at https://developer.android.com/reference/android/os/ParcelFileDescriptor#parseMode(java.lang.String).
This commit is contained in:
parent
3c2195127e
commit
de60443c21
@ -875,7 +875,7 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private fun exportNoteValueToUri(uri: Uri, content: String, callback: ((success: Boolean) -> Unit)? = null) {
|
||||
try {
|
||||
val outputStream = contentResolver.openOutputStream(uri)
|
||||
val outputStream = contentResolver.openOutputStream(uri, "wt")
|
||||
outputStream!!.bufferedWriter().use { out ->
|
||||
out.write(content)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user