obsidianmd / obsidian-importer

Obsidian Importer lets you import notes from other apps and file formats into your Obsidian vault.
https://help.obsidian.md/import
MIT License
739 stars 70 forks source link

Enable Longer File Names and Provide Warnings for Automatic Shortening #293

Open AltoRetrato opened 1 month ago

AltoRetrato commented 1 month ago

I noticed that some long file names are shortened after being imported, but often there is important information in file names that users do not want removed. I understand that there are file name length limitations on many systems, but it seems the longest total path for a file after importing was only 160 characters - yet I can easily create much longer file names. Ideally, the Importer plugin would ask me to rename any file if necessary, or at least inform me when it is automatically shortening file names.

AltoRetrato commented 1 month ago

I found the issue in getResourceFileProperties() (/src/formats/yarle/utils/filename-utils.ts): importer limits resource names to just 50 characters.

const fileNamePrefix = resource['resource-attributes']['file-name'].substr(0, 50);

As a workaround, I removed the .substr(0, 50) from the plugin code (.obsidian\plugins\obsidian-importer\main.js). This not only let me keep the attachments with their original names, but also solved issues where files were not correctly linked after importing notes from Evernote.