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

Fix images in note rich text #6550

Merged
merged 4 commits into from
Aug 7, 2024
Merged

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Aug 6, 2024

Before

Screenshot 2024-08-06 at 11 20 06

After

Screenshot 2024-08-06 at 11 20 09

Note: Not really happy with this implementation, ideally we should implement some generic logic for RICH_TEXT field type.
Note2: We should update the attachment table for new imported images, this was not done before but I'm creating a ticket for that.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This pull request addresses issues with images in note rich text by implementing secure access and improved handling of attachments and note bodies.

  • Added NoteQueryResultGetterHandler in note-query-result-getter.handler.ts to process note bodies and secure image access with signed tokens
  • Modified AttachmentQueryResultGetterHandler in attachment-query-result-getter.handler.ts to use AttachmentWorkspaceEntity type and add signed payload to fullPath
  • Updated QueryResultGettersFactory in query-result-getters.factory.ts to support note objects with the new handler
  • Improved security by ensuring only authorized users can access images in notes
  • Enhanced rich text functionality, fixing image display issues as shown in the before/after screenshots

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

workspaceId: string,
): Promise<NoteWorkspaceEntity> {
if (!note.id || !note.body) {
return note;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Wrap JSON.parse in a try-catch block to handle potential parsing errors

Copy link
Contributor

@bosiraphael bosiraphael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bosiraphael bosiraphael merged commit dce5a64 into main Aug 7, 2024
6 checks passed
@bosiraphael bosiraphael deleted the c--fix-images-in-note-rich-text branch August 7, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants