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
Bugfix: Fix Simplenote importer not titling multi-line documents #2798
Bugfix: Fix Simplenote importer not titling multi-line documents #2798
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please add a test case to SimplenoteConverter.spec.ts
. Hard to know the change of behavior without that.
packages/ui-services/src/Import/SimplenoteConverter/SimplenoteConverter.ts
Outdated
Show resolved
Hide resolved
From standardnotes#2798 (comment) Co-authored-by: Aman Harwara <amanharwara@protonmail.com>
58215ee
to
ba5e69d
Compare
ec7ec1e
to
a7f090f
Compare
@amanharwara Thanks for the suggestions! I've made some stylistic changes in-line with your suggestions, and modified the test data to include a note with more than 2 lines. In my testing, this case fails on the unpatched version (79951c3) and passes after my changes (27e7815). (Sorry for the noise with all the force-pushes. I can get a bit carried away making history "perfect".) |
SimplenoteConverter will now parse a title for any note with multiple lines, not just those with exactly two. Adds a string helper function splitAtFirst.
a7f090f
to
27e7815
Compare
(okay, one more...) |
@amanharwara Build and tests passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
SimplenoteConverter has a bug which causes it to only parse a title in notes which have exactly two lines. This is one of the issues addressed by jamesgecko/simple-to-standard.
Example data:
Current behavior: the second note is given a title.
This PR fixes that issue by replacing an instance of String.prototype.split with a new helper function, splitOnce, which splits a string only on the first occurrence of the delimiter.
After fix: multi-line notes are titled correctly.