-
Notifications
You must be signed in to change notification settings - Fork 155
Refactor HREF normalization and models #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a2c6490
to
cea32c7
Compare
36f001e
to
cd7774b
Compare
PR Analysis
PR Feedback
How to useInstructions
|
Changelog
Changed
RelativeURL
,AbsoluteURL
,HTTPURL
andFileURL
). This is helpful because:download(url: HTTPURL) -> FileURL
.Shared
Link
andLocator
'shref
are normalized as valid URLs to improve interoperability with the Readium Web toolkits.self
URL of a manifest anymore. However, you can still normalize the HREFs yourselves by callingManifest.normalizeHREFsToSelf()
.Publication.localizedTitle
is now optional, as we cannot guarantee a publication will always have a title (e.g. a CBZ).Migration guide
Migration of HREFs and Locators (bookmarks, annotations, etc.)
Locator
objects.In Readium v2.x, a
Link
orLocator
'shref
could be either:https://domain.com/isbn/dir/my%20chapter.html
,/dir/my chapter.html
./
).To improve the interoperability with other Readium toolkits (in particular the Readium Web Toolkits, which only work in a streaming context) Readium v3 now generates and expects valid URLs for
Locator
andLink
'shref
.https://domain.com/isbn/dir/my%20chapter.html
is left unchanged, as it was already a valid URL./dir/my chapter.html
becomes the relative URL pathdir/my%20chapter.html
/
prefix to avoid issues when resolving to a base URL.You must migrate the HREFs or Locators stored in your database when upgrading to Readium 3. To assist you, two helpers are provided:
AnyURL(legacyHREF:)
andLocator(legacyJSONString:)
.Here's an example of a GRDB migration that can serve as inspiration:
Kotlin PR: readium/kotlin-toolkit#387