Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem displaying images #106

Closed
nbljaved opened this issue Oct 1, 2024 · 11 comments
Closed

Problem displaying images #106

nbljaved opened this issue Oct 1, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@nbljaved
Copy link

nbljaved commented Oct 1, 2024

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 amake added the bug Something isn't working label Oct 1, 2024
@amake
Copy link
Owner

amake commented Oct 1, 2024

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
Copy link
Author

nbljaved commented Oct 1, 2024

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

@amake
Copy link
Owner

amake commented Oct 1, 2024

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

@amake
Copy link
Owner

amake commented Oct 1, 2024

Android 11+ appears to be incapable of handling colons in file paths:
google/adb-sync#34

@amake
Copy link
Owner

amake commented Oct 1, 2024

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
Copy link
Owner

amake commented Oct 1, 2024

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?

amake added a commit that referenced this issue Oct 1, 2024
Uri.resolve first parses its argument as a URI, so if relativePath is e.g. `foo:
bar` then it will be mistaken for a URI with scheme `foo`.

See #106
@nbljaved
Copy link
Author

nbljaved commented Oct 4, 2024

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

I am on Android 13 🥲 .

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
Copy link
Owner

amake commented Oct 4, 2024

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
Copy link
Owner

amake commented Oct 8, 2024

The image layout improvements are released on all platforms.

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

@nbljaved
Copy link
Author

nbljaved commented Oct 9, 2024

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. 🫡

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

Alright, I will just be careful with my headings.

@nbljaved nbljaved closed this as completed Oct 9, 2024
@amake
Copy link
Owner

amake commented Oct 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants