Skip to content

Commit 00efcc9

Browse files
authored
Fix normalization of URLs in MinizipContainer (#553)
1 parent 8219531 commit 00efcc9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/Shared/Publication/Link.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public struct Link: JSONEquatable, Hashable, Sendable {
167167
if href.isEmpty {
168168
href = "#"
169169
}
170-
return (AnyURL(string: href) ?? AnyURL(legacyHREF: href))!
170+
return (AnyURL(string: href) ?? AnyURL(legacyHREF: href))!.normalized
171171
}
172172

173173
/// Returns the URL represented by this link's HREF, resolved to the given
@@ -180,7 +180,7 @@ public struct Link: JSONEquatable, Hashable, Sendable {
180180
parameters: [String: LosslessStringConvertible] = [:]
181181
) -> AnyURL {
182182
let url = url(parameters: parameters)
183-
return baseURL?.anyURL.resolve(url) ?? url
183+
return baseURL?.anyURL.resolve(url)?.normalized ?? url
184184
}
185185

186186
// MARK: URI Template

Sources/Shared/Toolkit/ZIP/Minizip/MinizipContainer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ final class MinizipContainer: Container, Loggable {
6060

6161
subscript(url: any URLConvertible) -> (any Resource)? {
6262
guard
63-
let url = url.relativeURL,
63+
let url = url.relativeURL?.normalized,
6464
let metadata = entriesMetadata[url]
6565
else {
6666
return nil

0 commit comments

Comments
 (0)