donmor / Tiddloid

Tiddloid is an app to work with locally stored TiddlyWikis.
GNU General Public License v2.0
229 stars 10 forks source link

Tiddloid / Tiddloid Lite save error on Android 11 #25

Closed hubertgk closed 1 year ago

hubertgk commented 2 years ago

Originally reported in this Google Groups thread, I've experienced this issue today after installing Tiddloid on my Android 11 phone (no issues found on Android 8), saving my wiki and reloading.

Issue:

Code that appears to belong to the boot.js core tiddler is shown "underneath" the password encryption prompt and normal tiddlers after launching wiki can be seen on screenshots below.

tiddloid_code_issue1

tiddloid_code_issue2

In my Android 8 phone this was never an issue and I've been using Tiddloid Lite for years. The issue now appeared on my Android 11 phone, Tiddloid versions are the same on both phones.

Steps to reproduce:

  1. Open an (encrypted) TiddlyWiki in Tiddloid or Tiddloid Lite (on Android 11)
  2. Save the wiki
  3. Reopen the wiki

The code appears "underneath" the tiddler frame after the wiki is saved by Tiddloid/Tiddloid Lite and then reopened. Once it's saved like this, the code will also show on any mobile or desktop browser, it appears "burned in" but how much of the code is revealed depends on the height of the tiddler. It may take a few saves before it happens but once it does it is impossible to get rid of the code.

donmor commented 2 years ago

The code is, infact, remain of last veraion of your file. If opened in a text editor, you can find at least two </html>in the corrupted file. This seems to be a bug of Android 11, which caused files cannot be shrinked if accessed via SAF. Many issues created here due to this annoying problem. Currently no workaround found, but you can fix your file by deleting all content behind the first </html>.

hubertgk commented 2 years ago

Thanks for a quick reply donmor. I was suspecting this was related to the Android version.

I know you said no workaround currently and that saving corrupts files but at least the corruption can be manually reversed.

Do you think there is scope for a fix with Android's current SAF implementation in the longer term?

Thanks.

hubertgk commented 2 years ago

Hi @donmor

Maybe you could consider implementing the fallback saver as a temporary fix on Android 11+? This would basically download a copy of the html file in the same way as browsers normally do by default with single file wikis.

Another solution would be for Tiddloid to create its own folder in the Android/data folder and save to that folder because Android should allow access to that folder only.

Please let me know if any of these solutions are feasible?

Many thanks

donmor commented 2 years ago

Maybe you could consider implementing the fallback saver as a temporary fix on Android 11+? This would basically download a copy of the html file in the same way as browsers normally do by default with single file wikis.

But how to save the file? If using SAF chooser then you have to create a new file each time, and Google is blocking the legacy file:// protocol on interal storage.

Another solution would be for Tiddloid to create its own folder in the Android/data folder and save to that folder because Android should allow access to that folder only.

A nice idea for local-only notes, but these files can't be synced across devices, because Android/data is not accessable to 3rd party apps.

The best workaround is to use legacy mode: Find a file manager designed for Android <4.4, and open the HTML file with "Add to Tiddloid". You need some 3rd party apps to sync the file.

donmor commented 2 years ago

Are you using cloud services that support WebDAV? Now you can checkout the latest 2.2.0-pre version here (This is a pre-release with a debug package)

hubertgk commented 2 years ago

Hi Donmor, thanks. I'm not using WebDav (I prefer to work off an offline copy of the tw file) but I'd like to try the legacy mode that you mentioned in the Discourse group.

Unfortunately, I'm unable to install the debug apk file. I don't have any Tiddloid apps installed at the moment but when I try to install the apk file Android says that the apk package is invalid.

Thanks, Hubert

On Sat, 5 Feb 2022 at 07:36, donmor @.***> wrote:

Are you using cloud services that support WebDAV? Now you can checkout the latest 2.2.0-pre version here https://github.com/donmor/Tiddloid/releases/tag/2.2.0-pre (This is a pre-release with a debug package)

— Reply to this email directly, view it on GitHub https://github.com/donmor/Tiddloid/issues/25#issuecomment-1030570009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7VCZMO2J4KJJRWQMRY2KDUZTHQHANCNFSM5J3G5Y3Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

wallacerunner commented 2 years ago

I seem to have similar issue, Android 11, now updated to 12, TW is encrypted, saving via Tiddloid adds this line on top of password form and under the tiddlers area: / Check that no other outstanding tasks must be executed before this one for(t=0; t The rest, I think, is gracefully hidden by browser.

I checked further, and it is in fact the same issue, I found two </html> tags in there.

Then I have only one question: the added code doesn't seem to do anything, is it safe to leave this corruption as is, or should I take action on it?

donmor commented 2 years ago

Currently it is not reported insecure. The next version will have a temporary workaround, see #23 .

donmor commented 1 year ago

Hmm... Should I close this as this issue is duplicated to #23?

Dialga commented 1 year ago

This is a duplicate of #23, check https://stackoverflow.com/questions/56902845/how-to-properly-overwrite-content-of-file-using-android-storage-access-framework on solutions on how to fix.

donmor commented 1 year ago

Okay I uploaded 2.3.0 to GitHub/Gitee/CoolApk (F-droid version needs some time to be built). Try it and let me know if it ceased your problem.

donmor commented 1 year ago

Does anyone still have problem with 2.3.0 or later? I may close this if no problem reported.

donmor commented 1 year ago

No more bug reports since 2.3.0. Closing this. Reopen it if you're still concerned.