Skip to content

Conversation

@Xheldon
Copy link
Contributor

@Xheldon Xheldon commented Nov 12, 2025

Fix two issues:

  1. The import note path may be too long (including the total length of folder + filename), so it is truncated and the rename sequence number is incremented.
  2. Notes may lack certain attributes; add fault‑tolerant handling.

@tgrosinger tgrosinger changed the title Fixe Evernote importer bug #443 Fix Evernote importer bug #443 Nov 13, 2025

if (!yarleOptions.useZettelIdAsFilename) {
noteName += getFilePrefix(note) !== 'Untitled' ? `${separator}${getFilePrefix(note)}` : '';
const filePrefix = getFilePrefix(note);
Copy link
Contributor

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) {
Copy link
Contributor

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 => {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

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.

2 participants