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

Rich editor fails to load manually added embedded images #1171

Open
krisgesling opened this issue Dec 3, 2023 · 5 comments
Open

Rich editor fails to load manually added embedded images #1171

krisgesling opened this issue Dec 3, 2023 · 5 comments
Labels

Comments

@krisgesling
Copy link

Using the rich text editor on the Notes web interface displays "Failed to load" for (seemingly) any embedded image links that aren't created by the rich text editor.

I have been migrating users from Evernote to Nextcloud Notes. The migration tool by default stores media in a _resources/{note-title}.resources/ directory and uses the relative path for the image source in the markdown. At first I thought that something was breaking in the rich display when any media url starts with an underscore, however after further testing I can't get any embedded image link to work unless it's created by the rich text editor itself. Is something being written to the database to enable the display?

To verify I don't just have a syntax error, I've been validating that it works using a local markdown viewer.

Steps to reproduce

  1. Create note with an embedded image eg:
![image_file](_resources/note-title.resources/image_file.png)
  1. The rich editor will display a generic image icon and message: "Failed to load _resources/note-title.resources/image_file.png"
  2. I even tried changing an existing embedded image that was saved to the standard .attachments.xxxxxx directory. Renaming the directory to replace the first period with an underscore, and doing the same in the note markdown, results in the same issue of the image not displaying.
  3. Also tried prepending the uri with ./ to see if it was only the start of the string that caused the issue. But same result.
  4. I then tried making them fit the subdirectory naming that is generated when you use the rich editor to embed an image: .attachments.xxxxxx but again same result.
  5. I then tried a completely innocuous directory name note-title
  6. and finally no subdirectory

Expected behaviour

Relative image paths used in embedded image markdown should render in the rich text editor

Actual behaviour

None of these embedded image markdown links seem to work:

![image_file](_resources/note-title.resources/image_file.png)

or with the underscore char escaped:
![image_file](\_resources/note-title.resources/image_file.png)

or creating a notes "standard" subdirectory:
![image_file](.attachments.xxxxxx/note-title.resources/image_file.png)

no sub-directory at all:
![image_file](image_file.png)

Server

Please complete the following information.

  • Notes app version: 4.8.1
  • Nextcloud version: 27.1.3.2

Thanks

@krisgesling krisgesling added bug Something isn't working need to reproduce Issue that has not been reproduced labels Dec 3, 2023
@juliusknorr
Copy link
Member

@mejo- Since you recently worked on this, are relative urls like that now also covered by the text editor API in edit mode with a file id?

@mejo-
Copy link
Member

mejo- commented Dec 7, 2023

@mejo- Since you recently worked on this, are relative urls like that now also covered by the text editor API in edit mode with a file id?

Yes, should be. I guess that Notes uses the MarkdownContentEditor and passes the markdown content in, right? Then we'd need to pass a fileId along with useSession: false. See here.

@juliusknorr
Copy link
Member

No it uses the editor based on the file id as well with sessions.

Just verified it works fine in text but not notes. We seem to be missing to pass in the currentDirectory context

https://github.com/nextcloud/text/blob/60255e934e6781d4458f0fac21213216a0b148f1/src/services/AttachmentResolver.js#L105-L140

@Saijin-Naib
Copy link

Same behavior with OneNote files dumped to disk as MarkDown, which store all media in a media folder at the same level as the MarkDown notes.

Work perfectly locally, do not work in NextCloud Notes web, Android, no Iotas on Linux.

@keithvassallomt
Copy link

Sorry to bring this up again. I’m currently working on a tool to migrate Apple Notes to NextCloud Notes, and have this exact issue. Has any progress been made on this please?

I have also reproduced by manually creating a Markdown file with a link, same behaviour as OP.

And yes, Apple don’t make it easy 😂 but I’m getting there!

@joshtrichards joshtrichards added 1. to develop feature: attachments and removed need to reproduce Issue that has not been reproduced labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants