OneDrive for Android can corrupt text files

pekspro 1 Reputation point
2021-10-27T17:05:05.36+00:00

I have created an app for Android where users could create lists of words (https://play.google.com/store/apps/details?id=com.pekspro.vokabel). These lists are stored as files. The user is using the "file picker" in Android to select which file to use. In this file picker you could select to open files from OneDrive. My app doesn't know where the file is located or if OneDrive or some other service is in use.

I have noticed that if you in my app remove some items and add some new items the file is getting corrupted. The app is storing all files in a text-based format. But this only happens when I work with files that are in OneDrive. Local files or files on Google Drive or Dropbox is not getting corrupted.

It is possible to replicate this issue in a simple text editor. For instance, these two:

https://play.google.com/store/apps/details?id=com.abhishek.oldschooleditor
https://play.google.com/store/apps/details?id=com.byteexperts.texteditor

I have also created a super simple editor myself just to demonstrate the issue:

https://github.com/pekspro/CorruptFileDemo

First, create a text file with this content on a computer and save it on
OneDrive:

A
B
C
D
E

Next, open the file in this app. Remove the last three lines, and add a new
line:

A
B
1

Save the file. Then open it again, either in the app or on a computer. The
content will now be:

A
B
1
D
E

I have tested this in OneDrive for Android version 6.41. I have used both in Android 8 and Android 10 with different accounts and devices.

I have reported this earlier:

https://answers.microsoft.com/en-us/msoffice/forum/all/onedrive-for-android-can-corrupt-text-files/b7f46dd1-35c9-4128-a3d7-0a8ad1b9c351

I have also been in direct contact with the support (case id: 1028245617) and after a lot of conversations I get referred here.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,408 questions
{count} votes