Fix page paths

Update PostListPageGenerator.swift
This commit is contained in:
Christoph Hagen
2025-01-07 10:31:46 +01:00
parent f8150e0809
commit dd2b7d6cd2
7 changed files with 31 additions and 8 deletions

View File

@ -38,7 +38,7 @@ struct SecurityBookmark {
}
func fullPath(to relativePath: String) -> URL {
url.appending(path: relativePath, directoryHint: .notDirectory)
return url.appending(path: relativePath.withLeadingSlashRemoved, directoryHint: .notDirectory)
}
/**
@ -167,7 +167,7 @@ struct SecurityBookmark {
return false
}
let destination = url.appending(path: relativeDestination)
let destination = url.appending(path: relativeDestination.withLeadingSlashRemoved)
if exists(destination) {
switch overwrite {
case .fail:
@ -328,11 +328,11 @@ struct SecurityBookmark {
// MARK: Generic operations
func with(relativePath: String, perform operation: (URL) -> Bool) -> Bool {
perform { operation($0.appending(path: relativePath)) }
perform { operation($0.appending(path: relativePath.withLeadingSlashRemoved)) }
}
func with<T>(relativePath: String, perform operation: (URL) -> T?) -> T? {
perform { operation($0.appending(path: relativePath)) }
perform { operation($0.appending(path: relativePath.withLeadingSlashRemoved)) }
}
/**