Skip to content

Commit

Permalink
Merge pull request #41 from theohbrothers/fix/add-normalization-of-th…
Browse files Browse the repository at this point in the history
…e-notes-destination-path-to-have-no-trailing-slashes-or-backslashes

Fix: Add normalization of the notes destination path to have no trailing slashes or backslashes
  • Loading branch information
leojonathanoh committed Jul 30, 2021
2 parents 93d0432 + 525e8e1 commit a0f8d3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ConvertOneNote2MarkDown-v2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Function ProcessSections ($group, $FilePath) {
else {
$mediaPath = $NotebookFilePath.Replace('\', '/') # Normalize markdown media paths to use front slashes, i.e. '/'
}
$mediaPath = ($mediaPath.Substring(0, 1).tolower() + $mediaPath.Substring(1)).Replace('\', '/') # Normalize markdown media paths to use front slashes, i.e. '/'
$mediaPath = $mediaPath.Substring(0, 1).tolower() + $mediaPath.Substring(1) # Normalize markdown media paths to use a lowercased drive letter

# in case multiple pages with the same name exist in a section, postfix the filename. Run after pages
if ([System.IO.File]::Exists("$($fullfilepathwithoutextension).md")) {
Expand Down Expand Up @@ -386,7 +386,7 @@ try {
if (! (Test-Path -Path $notesdestpath -PathType Container -ErrorAction SilentlyContinue) ) {
throw "Notes root path does not exist: $notesdestpath"
}
$notesdestpath = $notesdestpath.Trim('\')
$notesdestpath = $notesdestpath.Trim('/').Trim('\') # Normalize notes paths to have no trailing slash or backslashes

if ($prefixFolders -eq 2) {
$prefixFolders = 2
Expand Down

0 comments on commit a0f8d3b

Please sign in to comment.