-
Notifications
You must be signed in to change notification settings - Fork 156
Fix Evernote importer bug #443 #449
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| if (!yarleOptions.useZettelIdAsFilename) { | ||
| noteName += getFilePrefix(note) !== 'Untitled' ? `${separator}${getFilePrefix(note)}` : ''; | ||
| const filePrefix = getFilePrefix(note); |
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.
Looks like this getFilePrefix can be hoisted out of the if condition since both cases use it now.
| if (filePrefix !== 'Untitled') { | ||
| const combined = `${noteName}${separator}${filePrefix}`; | ||
| // Truncate if combined name is too long | ||
| if (combined.length > MAX_NOTE_NAME_LENGTH) { |
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.
Maybe just rewrite this so that there is no else case required. Instead, calculate the available space and always add a substr from filePrefix of that length. I think that will allow simplifying this section a bit.
| * @param suffix - Optional suffix to append (e.g., '.resources') | ||
| * @returns A unique name that doesn't conflict with existing items | ||
| */ | ||
| const getUniqueNameForPath = (basePath: string, name: string, suffix: string = ''): string => { |
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.
I think I remember you adding something similar in the notion api PR? Maybe something like this should be a utility format that can be shared between both.
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.
Yes, there's also similar tag‑generation logic. However, because I haven't worked with many other importer implementations, these are the only two functions that can be extracted globally, and I'll address this later.
Fix two issues: