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

Images not working when "Export to Link" was used #53

Closed
Someone0nEarth opened this issue Feb 23, 2024 · 10 comments · Fixed by #56
Closed

Images not working when "Export to Link" was used #53

Someone0nEarth opened this issue Feb 23, 2024 · 10 comments · Fixed by #56

Comments

@Someone0nEarth
Copy link
Contributor

First things first: Thanks for your work!!

I got the collaboration mode to work, but there are some anomalies when dealing with images:

Images working fine in the collaboration mode:

grafik

Until someone did a save using "Export to Link". When using the link, only a placeholder for the image will be shown:

grafik

When using the room-share link after doing the "Export to Link" the images wont be shown too.

When doing a "Save to disk", the images are referenced in "elements", but the "files" are empty.

Ways to reproduce:

1) Export to Link

  1. Create a new drawing and pasting an image into it.
  2. Do a "Export to Link"
  3. Using the export-link: Now, only the placeholder will be shown

2) Export to Link after starting a Live Collaboration

  1. Create a new drawing and pasting an image into it.
  2. Starting a "Live collaboration": Image will be shown, when using the collaboration-link
  3. Do a "Export to Link"
  4. Using the collaboration-link: Now, only the placeholder will be shown (the same when using the export-link)

3) Export to Link before starting a Live Collaboration

  1. Create a new drawing and pasting an image into it.
  2. Do a "Export to Link"
  3. Using the export-link: Now, only the placeholder will be shown
  4. NOW start a "Live collaboration"
  5. Using the collaboration-link: Now, the image (!) will be shown
  6. Do another "Export to Link"
  7. Using the collaboration-link again: Now, only the placeholder (!) will be shown

Summary

As soon as a "Export to link" was done, images will be shown only as a placeholder. Beside the one special case in 3), when a collaboration session was`t started, it will work until the next "Export to link" for the collaboration mode.

Btw: When restarting all the services, images will still be shown when using the collaboration link (until the drawing was "exported to link"). So there is some kind of working image persistence.

I'm using alswl/excalidraw:v0.17.0-fork-b2, alswl/excalidraw-storage-backend:v2023.11.11 and excalidraw/excalidraw-room:sha-49bf529. But same behavior when using excalidraw/excalidraw-room.

I tried this with redis, postgres and mongodb.

@Someone0nEarth
Copy link
Contributor Author

Some more additional infos:

Rooms, scenes and files are stored in the mongo:

grafik

And using "rooms" only, files working as aspected, until a scene with this file is created.. than files wont load for rooms and scenes. In the file-exports, the linked "fileId" is correct and still present in the db. Even the file itself is identical, besides "files" is empty: "files": {}`

@Someone0nEarth
Copy link
Contributor Author

Hello again,

I did a little more digging into it. My knowledge of Javascript frameworks etc are limited... but maybe these are the reasons, why files are not working with "http storage" as soon they are is in scenes:

https://github.com/alswl/excalidraw/blob/1d751e7dc15d1f1b00101e52cf1607bbedccef1c/excalidraw-app/index.tsx#L333

grafik

https://github.com/alswl/excalidraw/blob/1d751e7dc15d1f1b00101e52cf1607bbedccef1c/excalidraw-app/index.tsx#L358

grafik

As I said, my knowledge of JS etc. is limited, so, sadly, I won't be able to proof or fix this in a affordable time.

But maybe, this was helping ...

@farapholch
Copy link

farapholch commented Feb 28, 2024

@Someone0nEarth I'm unable to even export the link, not sure whats wrong with my config, heres the error message:

image

image

@Someone0nEarth
Copy link
Contributor Author

@Someone0nEarth I'm unable to even export the link, not sure whats wrong with my config, heres the error message:

Hey @farapholch I would bet, changing the backend GET and POST URL pathes too /api/v2/scenes/ will fix your issues.

@farapholch
Copy link

farapholch commented Feb 29, 2024

@Someone0nEarth thank you so much! :) Its now working.

@woremacx
Copy link

@alswl
Thank you for the great changes.

I made some changes that I believe can solve this issue and have submitted a PR.
Please check it out.

Init storageBackend before use it by woremacx · Pull Request #30 · alswl/excalidraw

@Someone0nEarth
Copy link
Contributor Author

@alswl Thank you for the great changes.

I made some changes that I believe can solve this issue and have submitted a PR. Please check it out.

Init storageBackend before use it by woremacx · Pull Request #30 · alswl/excalidraw

Thanks @woremacx !! That fixed it! Now the images are working!!

@alswl Please pull woremacx fix :D

@alswl
Copy link
Owner

alswl commented Mar 11, 2024

@woremacx
Cool, I'w review this changes and release a new version.

@alswl
Copy link
Owner

alswl commented Mar 11, 2024

Now the new version is released, and the demo site( https://excalidraw-production-4d27.up.railway.app/) is upgraded.
You can check out the new image.

Thanks a lot to @Someone0nEarth and @woremacx .

@woremacx
Copy link

Thanks @alswl for great hack, and @Someone0nEarth for docker-compose files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants