Failed to convert page when sub pages are double nested
Closed this issue ยท 8 comments
Single nesting pages in the right panel is fine, however, when we have a double nesting I find we face conversion problems:
Root
> > Nested Double Space
> > Nested Double Space v2
> Nested 2.2
Example image where error is thrown:
Error message:
### Nested 2.2 [Page]
Failed to convert page: test-Section-1\Nested-2.2. Reason: Failed to create directory '\': The path is not of a legal form.
Convert-OneNotePage : Failed to convert page: test-Section-1\Nested-2.2. Reason: Failed to create directory '\': The path is not of a legal form.
At C:\{REDACTED PATH}\ConvertOneNote2MarkDown-v2.ps1:1247 char:254
+ ... onConfigs | Convert-OneNotePage -OneNoteConnection $OneNote -Config $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Convert-OneNotePage
@wjkw1 could u post the output of your $PSVersionTable
, and post the logs when running with -Verbose
E.g. .ConvertOneNote2MarkDown-v2.ps1 -Verbose
?
This does seem like a bug in the determination of the directories to create. It could be that your powershell version is < 5.1, which somehow doesn't play nice with [io.path]::combine()
.
i believe this might also be due to the support for long path names #90 which might not be supported on older Windows, e.g. < Windows 10.
I will roll out a quick fix, where if any absolute path falls within its limit, the short path i.e. C:\path\to
will be preferred, and if the path exceeds its limit, the long path will be used i.e. \\?\C:\path\to
which assumes the user has enabled long path support, or the script will throw errors about failing to create those paths.
Hey @wjkw1, thanks the bug report. The fix is rolled out in the latest release v2.15.1
. I did a conversion of a notebook with your structure and no longer get the error. Please try it out and let me know it's its working.
@leojonathanoh Thanks for the swift response. I'm glad you were able to reproduce and found a fix.
I just tested the script and I can confirm that the fix corrected the issue I was having.
Awesome work!!
glad it worked, im actually in the process of converting many notebooks, i just haven't run in to any notebook that has an arrangement of pages like in #97, but it was just a matter of time.