Problems with ":" in note titles
rgutmann opened this issue · comments
Reason: creating files with ":" is not supported.
A simple Parse.title([...]).replace(":"," - ") was sufficient for me, but the bug should be fixed imho.
@rgutmann what error are you getting?
No error at all, just missing notes. Which is the worst case... Btw, it's not only ":", also "?", ">", """, etc... and replace is only replacing once per call, so my hack got ugly quick (my first nodejs app - sigh).
Main reason seems to be the empty catch block in File.write() - adding console.log(filePath) was helpful to find all my missing notes:
`
async write ( filePath, content ) {
try {
return await pify ( fs.writeFile )( filePath, content );
} catch ( e ) {
if ( e.code === 'ENOENT' ) {
try {
await pify ( mkdirp )( path.dirname ( filePath ) );
return await pify ( fs.writeFile )( filePath, content );
} catch ( e ) {
console.log(filePath);
}
}
}
}`
I think you should also catch the unsuccessful ones there to be able to output them in case you've got errors in Notable-import function.
Btw - I like Notable very much - keep up the good work! :)
so my hack got ugly quick (my first nodejs app - sigh).
Do .replace ( /"/g, '' )
to replace all instances of that character.
I think I know what the problem is, some characters aren't allowed in filenames and the file isn't written.
I think this issue has been fixed, titles and names are now sanitized.