-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
(Bug report) TypeError: Cannot read properties of undefined (reading 'attachmentId') when copy/pasting images #4566
Comments
Hello, thank you for the detailed report, should be fixed in the next patch release. |
Thank you @zadam ! Just a quick heads up, since you're now escaping the url, the function I tried replacing In order to replicate:
You can see in the developer console that's making requests to the 3rd party site every time you open the note. |
@ghgr hello, thank you for further testing. The previous fix was unescaping the URL in an incorrect place which then made it impossible to find the correct URL in HTML to replace. Bill Gates is now getting properly replaced. |
Trilium Version
0.62.4
What operating system are you using?
Ubuntu
What is your setup?
Server access only
Operating System Version
(Server) Ubuntu 22.04 LTS (Client) Debian 11
Description
When an image is copy pasted from Chromium into a new note, I get in the backend logs:
In /usr/src/app/src/services/notes.js:499 I see that
attachment
is undefined, but the function that returns it (imageService.saveImageToAttachment
) is returning it correctly. If In notes.js I makeattachment
a variable instead of aconst
, it works.But when I refresh the note it doesn't find the image anymore. It turns out that
notes.js:514
is not writing the path to the local image correctly. I had to modify it to be like this:And now it works. It downloads images pasted imaged and can display them properly. Unless the image url contains special symbols, like &. In that case, I get:
Don't be fooled by the
Forbidden
. It's not behind a login, but look at the "&". It turns out the url is not being correctly parsed byrequest.js
. If I patch it like this (Line 116):It works now.
In Summary, I think I found 3 bugs:
notes.js
Line 497. Attachment was not being stored asconst
. Replaced tovar
.notes.js
Line 514. Url to local image was not correctly set.request.js
Line 116. url was not being correctly escaped when containing&
.Error logs
No response
The text was updated successfully, but these errors were encountered: