amake / orgro

An Org Mode app for iOS and Android
https://orgro.org
GNU General Public License v3.0
490 stars 23 forks source link

Problem displaying images #106

Closed nbljaved closed 1 week ago

nbljaved commented 2 weeks ago

When relative link to my image file is [[file:Achieving_ACID:_Serial_Execution/2024-07-17_16-43-26_screenshot.png]] then Orgro displays a super long grey box.

In Emacs: image In Orgro: Screenshot_20241001_140150_Orgro

But, when I copy that image file and move it into a folder named Achieving_ACID_-_Serial_Execution (earlier it was Achieving_ACID:_Serial_Execution), i.e. in the new folder name has a _- instead of a : , then it displays fine in Orgro.

In Emacs (after): image In Orgro (after): Screenshot_20241001_140958_Orgro

amake commented 2 weeks ago

There are two problems:

  1. When Orgro fails to resolve an image, it should take up a reasonable amount of space
  2. Orgro shouldn't fail to resolve this image

There's an error in resolving relative paths containing colons (as you probably guessed). I will fix it soon.

nbljaved commented 2 weeks ago

@amake Thank you for your work :pray:. I like to walk while studying and Orgro has been a blessing, allowing me to review my notes whenever and wherever.

amake commented 2 weeks ago

What platform are you running Orgro on, and where are you storing your files?

amake commented 2 weeks ago

Android 11+ appears to be incapable of handling colons in file paths: https://github.com/google/adb-sync/issues/34

amake commented 2 weeks ago

Sorry, the bugs I found and fixed are related, but probably won't fix your issue if you're on Android. Android apparently forbids : among other characters, and additionally it can depend on the filesystem you're using. I can only recommend not using : if you're on Android.

amake commented 2 weeks ago

I also can't reproduce the poor layout issue. When an image doesn't resolve, the current version of Orgro shows an error message, not a gray square.

What version of Orgro are you using?

nbljaved commented 2 weeks ago

I can only recommend not using : if you're on Android.

I am on Android 13 :smiling_face_with_tear: .

I also can't reproduce the poor layout issue. When an image doesn't resolve, the current version of Orgro shows an error message, not a gray square.

What version of Orgro are you using?

I am on Orgro 1.40.4 .

What platform are you running Orgro on, and where are you storing your files?

I am using Termux, and doing a git pull to get my org files onto Termux's filesystem. https://wiki.termux.com/wiki/Termux-setup-storage So the $HOME on termux is /data/data/com.termux/files/home. /data/data/com.termux/files/home/storage/shared symlinks to /storage/emulated/0 and my repository is stored at /data/data/com.termux/files/home/storage/shared/Documents/my-repo/my-org-file.org

amake commented 1 week ago

Thanks for the details. I tried to recreate your setup on my Android 11 device, and I found the following:

When cloning a repository (actually this one) containing the directory assets/test/foo: bar/, I found that the directory itself was created correctly but the contents failed to be written.

$ termux-setup-storage
$ cd storage/shared
$ git clone https://github.com/amake/orgro.git
$ ls orgro/assets/test/foo:\ bar/
# no files listed (directory is empty)

Can you see if the files you expect actually exist?

Also, I note that everything works if your git clone is inside the Termux filesystem:

$ cd # move to home
$ git clone https://github.com/amake/orgro.git
$ ls orgro/assets/test/foo:\ bar/
links-unusual-path.org unicorn-1.svg

Because Termux implements the Storage Access Framework, Orgro is able to open files directly from within Termux's filesystem. If that works for your use case, I would recommend doing that instead.

amake commented 1 week ago

The image layout improvements are released on all platforms.

There is nothing I can do to make paths with : work on local storage.

nbljaved commented 1 week ago

Because Termux implements the Storage Access Framework, Orgro is able to open files directly from within Termux's filesystem. If that works for your use case, I would recommend doing that instead.

I normally do just that.

The image layout improvements are released on all platforms.

Thanks for deep diving into this issue. :saluting_face:

There is nothing I can do to make paths with : work on local storage.

Alright, I will just be careful with my headings.

amake commented 1 week ago

Because Termux implements the Storage Access Framework, Orgro is able to open files directly from within Termux's filesystem. If that works for your use case, I would recommend doing that instead.

I normally do just that.

You said you put your checkout under $HOME/storage/shared/. I'm saying it should work if you keep it under $HOME. Colons in paths should work there.