From 57fa668266355e60939b98ffc9b5265f9d3187ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Menu?= Date: Tue, 4 Jun 2024 14:02:53 +0200 Subject: [PATCH] Fix resolving search results title --- CHANGELOG.md | 9 ++++++++- Sources/Internal/Extensions/String.swift | 2 +- .../InternalTests/Extensions/StringTests.swift | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Tests/InternalTests/Extensions/StringTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index d86bf9580..f94a536bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file. Take a look **Warning:** Features marked as *alpha* may change or be removed in a future release without notice. Use with caution. - +## [Unreleased] + +### Fixed + +#### Shared + +* [#444](https://github.com/readium/swift-toolkit/issues/444) Fixed resolving titles of search results when the table of contents items contain fragment identifiers. + ## [2.7.1] diff --git a/Sources/Internal/Extensions/String.swift b/Sources/Internal/Extensions/String.swift index 1f9609c87..36457aabe 100644 --- a/Sources/Internal/Extensions/String.swift +++ b/Sources/Internal/Extensions/String.swift @@ -67,7 +67,7 @@ public extension String { guard let range = range(of: delimiter, options: [.backwards, .literal]) else { return self } - return String(self[...range.lowerBound]) + return String(self[..