afonsotrepa / PocketGopher

Gopher browser for android written in java
The Unlicense
46 stars 9 forks source link

Urlencode bookmark URLs #19

Open jnlon opened 4 years ago

jnlon commented 4 years ago

When bookmarking a page with a 'tab' character in the URL, PocketGopher will crash on startup and not start again until app data is cleared. This is because the bookmarks file is tab delimited, and the extra field causes an exception from parseInt. To prevent raw tab characters from ending up in the bookmarks file, this PR calls url encode/decode before reading/writing urls to the bookmarks file. This is also backwards compatible since URLDecode ignores special characters that would normally be url-encoded, so old bookmarks still work.

Xzenia commented 4 years ago

Great work! I hope your fixes get merged soon.

softgenix commented 4 years ago

Ug. Just had this happen. Is there anyway to save my book marks, or must I start over?

jnlon commented 4 years ago

@softgenix As far as I can tell there are 2 conditions where it is possible:

  1. You have root on your device

  2. You are running a debug build of the app (ie, not from F-droid)

If either is true you can retrieve the bookmarks with ADB. If you have root and its enabled for ADB in developer settings, this prints your bookmarks to the command-line:

adb root && adb shell cat /data/data/com.gmail.afonsotrepa.pocketgopher/files/bookmarks

Same thing but for debug builds, this works on my device:

adb shell run-as com.gmail.afonsotrepa.pocketgopher cat /data/data/com.gmail.afonsotrepa.pocketgopher/files/bookmarks