Skip to content

Commit

Permalink
Fix normalization of URLs in MinizipContainer (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Feb 11, 2025
1 parent 8219531 commit 00efcc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/Shared/Publication/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public struct Link: JSONEquatable, Hashable, Sendable {
if href.isEmpty {
href = "#"
}
return (AnyURL(string: href) ?? AnyURL(legacyHREF: href))!
return (AnyURL(string: href) ?? AnyURL(legacyHREF: href))!.normalized
}

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

// MARK: URI Template
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Toolkit/ZIP/Minizip/MinizipContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ final class MinizipContainer: Container, Loggable {

subscript(url: any URLConvertible) -> (any Resource)? {
guard
let url = url.relativeURL,
let url = url.relativeURL?.normalized,
let metadata = entriesMetadata[url]
else {
return nil
Expand Down

0 comments on commit 00efcc9

Please sign in to comment.