wormi4ok / evernote2md

Convert Evernote .enex files to Markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filename too long issue

sedlund opened this issue Β· comments

Problem statement
filesystem issue with note naming -- windows:

2021/03/17 16:11:39 [DEBUG] Saving file .\notes/2015_blablablabla.md
2021/03/17 16:11:39 [DEBUG] Saving attachment .\notes\file/_ui_2_ik_55810e016a_attid_0-1_th_14ed6660a2f337a6_view_at
t_zw_disp_inline_saddbat_ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rGYl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh
9dk6jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxp.pdf
2021/03/17 16:11:39 [ERROR] save resource .\notes\file/_ui_2_ik_55810e016a_attid_0-1_th_14ed6660a2f337a6_view_att_zw
_disp_inline_saddbat_ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rGYl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh9dk6
jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxp.pdf: open .\notes\file\_ui_2_ik_55810e016a_atti
d_0-1_th_14ed6660a2f337a6_view_att_zw_disp_inline_saddbat_ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rG
Yl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh9dk6jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxp.pdf: The s
ystem cannot find the path specified.

Hmm. On linux too:

2021/03/17 22:19:22 [DEBUG] Saving attachment ./notes/file/?ui=2&ik=55810e016a&attid=0-1&th=14ed6660a2f337a6&view=att&zw&disp=inline&saddbat=ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rGYl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh9dk6jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxpC7qDEI5.pdf
2021/03/17 22:19:22 [ERROR] save resource ./notes/file/?ui=2&ik=55810e016a&attid=0-1&th=14ed6660a2f337a6&view=att&zw&disp=inline&saddbat=ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rGYl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh9dk6jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxpC7qDEI5.pdf: open ./notes/file/?ui=2&ik=55810e016a&attid=0-1&th=14ed6660a2f337a6&view=att&zw&disp=inline&saddbat=ANGjdJ9rCntiivHBHioFw1oc5_6VNy_aWhsYr0sLbpSxKIQfiQABVBN5rGYl0kPsXk9qsFE8OOQWPjIdxvxTuqLcqCh9dk6jDGZlOYI7-6HJMM0Nywr3vssbntQCW1jttD8cXlrZ5zX3MUYKp7o7iEFXM41RVOXmdxpC7qDEI5.pdf: file name too long

Example file

It looks like I need help here.

The problem with file names seems never-ending ( #4, #13, #20 ). I've implemented many normalisation and sanitisation steps, defined custom rules per OS, but there are too many unknowns, mainly out of the application's scope.

Maybe I'm missing something, but from what I've read so far on the topic "dynamic filenames based on user data", the recommendation was - forget it. And the easy solution would be to use sequential numbers as names. Erase the original filename so all attachments would be 1.jpg, 2.pdf and so on. I'm not too fond of this approach since we lose information that naturally matches the filesystem concept.

If you found a workaround for this issue - I could add it in the app to print a hint for users on how to tweak your environment to make it work. Try to use C:\notes as output directory or something like this (If it actually helps, I guess it should)

Could you please temporarily add a functionality that simply warns the user that some file will be missed but the process won't stop?

commented

Maybe you could use sequential numbers as names and write the string you used as filename to the FrontMatter area.

Storing the note name in frotmatter is possible, but I'm not sure how many people actually use frontmatter and find it helpful. Frontmatter is a relatively new feature and may be confusing for some users.
I lean towards what @Astromis suggested; this sounds like a good middle-ground solution.

The suggestion as mentioned above is implemented in 0.17.0. Hope it helps πŸ™πŸ»

Hello.

Unfortunately, I still have an issue. Here is an error message.

Interestingly that note counter fluctuates near 70 as I repeat the running.

PS C:\Users\aarma\Desktop\evernote export> .\evernote2md.exe input
Notes: 69 / 185 [=================================>_______________________________________________________] 37.30% 1.4
spanic: strings: negative Repeat count

goroutine 1 [running]:
strings.Repeat(0x53f096, 0x4, 0xffffffffffffffff, 0x11f, 0x0)
        /opt/hostedtoolcache/go/1.16.5/x64/src/strings/strings.go:529 +0x5e5
github.com/mattn/godown.walk(0xc01f775420, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:436 +0x2826
github.com/mattn/godown.walk(0xc01f7753b0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f774fc0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f774cb0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f774c40, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f774bd0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f774b60, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f771ea0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f770d90, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f770bd0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f770af0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f770a80, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f770a10, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f7709a0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f447960, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f4478f0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f447880, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f447810, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f447730, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f4476c0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:361 +0x135b
github.com/mattn/godown.walk(0xc01f4475e0, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:493 +0x658
github.com/mattn/godown.walk(0xc01f447570, 0x588e78, 0xc01f345200, 0x0, 0xc02179ff00)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:493 +0x658
github.com/mattn/godown.Convert(0x588e78, 0xc01f345200, 0x588e98, 0xc01f345230, 0xc02179ff00, 0xc01f351d60, 0x0)
        /home/runner/go/pkg/mod/github.com/mattn/godown@v0.0.2-0.20210508133137-72c48840c3e3/godown.go:554 +0x1a7
github.com/wormi4ok/evernote2md/encoding/markdown.Convert(...)
        /home/runner/work/evernote2md/evernote2md/encoding/markdown/markdown.go:49
github.com/wormi4ok/evernote2md/internal.(*Converter).toMarkdown(0xc00018a300, 0xc016492b48, 0xc0186d9400)
        /home/runner/work/evernote2md/evernote2md/internal/convert.go:142 +0x170
github.com/wormi4ok/evernote2md/internal.(*Converter).Convert(0xc00018a300, 0xc016492b48, 0xc008069e88, 0x1, 0x1)
        /home/runner/work/evernote2md/evernote2md/internal/convert.go:80 +0x1f1
main.run(0xc0001f4100, 0x9, 0x10, 0xc008069f58, 0xc0001f6000, 0xc00018a300)
        /home/runner/work/evernote2md/evernote2md/main.go:83 +0x28a
main.main()
        /home/runner/work/evernote2md/evernote2md/main.go:68 +0x6db

Great, thanks for testing this @Astromis. I couldn't reproduce the problem locally, so it was coding blindly. Will check again today.

@wormi4ok
Here is my pack of notes that I try to convert. I should attached it earlier :)

https://drive.google.com/file/d/1AiCWpEELJNvS5AjfV7t1YAFVaHN0gZI2/view?usp=sharing

Yes, that's very helpful. I could reproduce it on my laptop. Expect a patch to arrive soon! πŸ‘πŸ»

I've looked into the problem you reported. It turns out to be a bug in the new version of the library. So it won't be that easy to fix.

Sad to hear. At least, this bug can be reported to the library developers.

I already have a fork of this library and should be able to fix the problem. Will just take some more time

Released a patch that fixes the issue you mentioned - v0.17.1 I could convert your sample without any errors @Astromis πŸ‘πŸ» Let me know if it works for you.

Yes, it works for me too. Awesome! Thank you.