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 for issue #2088 : snippet notes are not displaying in markdown #2253

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

mbarczak
Copy link

Fix for issue #2088.
In specific situation, when all below conditions are met :

  • one of the snippets notes tabs is a Markdown tab,
  • the migrateAttachments code is called on a snippet note,
  • historical attachments location '/images' exists in snippet storage folder

Following exception is being thrown :

path.js:28 Uncaught TypeError: Path must be a string. Received undefined
at assertPath (path.js:28:11)
at Object.join (path.js:1251:7)
at createAttachmentDestinationFolder (:84:25)
at Object.migrateAttachments (:101:7)
at MarkdownPreview.rewriteIframe (:512:28)
at MarkdownPreview.proxiedMethod (:44:30)
at MarkdownPreview.componentDidUpdate (:420:54)
at MarkdownPreview.proxiedMethod (:44:30)

As a result, Markdown tab is not being rendered.
The exception is a result of an undefined noteKey variable (which is defined only for full Markdown notes, not for Markdown tabs of a Snippet Note).
The solution is to skip migration of attachments for notes without noteKey (which wouldn't be possible anyway, since noteKey is a necessary for creating folder for attachments).

Additionally, the condition attachments !== [] has been changed to attachments.length , because the first one always returns true , as in simple js console example :

97dd6db5-742b-4aaa-a8eb-e2fbbf0fd30f

Maciek added 2 commits July 28, 2018 22:23
Fix for issue BoostIO#2088.
In specific situation, when all below conditions are met :
- one of the snippets notes tabs is a Markdown tab,
- the migrateAttachments code is called on a snippet note,
- historical attachments location '/images' exists in snippet storage
  folder

Following exception is being thrown :
path.js:28 Uncaught TypeError: Path must be a string. Received undefined
The exception is a result of an undefined noteKey variable
(which is defined only for Markdown notes).
The solution is to skip migration of attachments for notes without
noteKey (which wouldn't be possible anyway, since noteKey is a
necessary for creating folder for attachments).
The original condition : attachments !== [] always returns true,
for empty array, as well as for array with elements.
@kazup01 kazup01 added the awaiting review ❇️ Pull request is awaiting a review. label Jul 30, 2018
@Rokt33r Rokt33r added next release (v0.11.9) and removed awaiting review ❇️ Pull request is awaiting a review. labels Aug 9, 2018
@Rokt33r Rokt33r merged commit 38af257 into BoostIO:master Aug 9, 2018
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 this pull request may close these issues.

3 participants