Skip to content

JSON Locator not parsing Fragments correctly #263

@jspizziri

Description

@jspizziri

Bug Report

It appears that this libraries Locator isn't automatically parsing #'s in hrefs and adding them as fragments to the Locator objects locations. I'd also like to note that the kotlin-toolkit seems to be doing this fine.

What happened?

If you pass a JSON object like the one below to the Locator constructor you will not be properly navigated to it, as the fragment isn't parsed.

{
    "href": "7604861093435514544_67098-h-0.htm.xhtml#pgepubid00012",
    "type": "application/xhtml+xml"
}

Expected behavior

It seems like for consistency withkotlin-toolkit we should be parsing those fragments and adding them automatically. Perhaps similar to how the deprecated Link constructor is doing it.

How to reproduce?

  1. Feed the attached epub file into the Readium app: pg67098-images-3.epub.zip
  2. Build a Locator object out of the above JSON object.
  3. Feed the Locator to navigator.go.
  4. Observe that the link is not properly navigated to.

Environment

  • Readium version: 2.4.0

Testing device

  • iOS version: 16.1
  • Model (e.g. iPhone 11 Pro Max): iPhone 14 Pro
  • Is it an emulator? Yes
  1. Feed the attached epub file into the Readium app.
  2. Build a Locator object out of the above JSON object.2. Build a Locator object out of the above JSON object.
  3. Feed the Locator to navigator.go.
  4. Observe that the link is not properly navigated to.4. Observe that the link is not properly navigated to.

Environment### Environment

  • Readium version: 2.4.0* Readium version: 2.4.0

Testing device#### Testing device

  • iOS version: 16.1* iOS version: 16.1
  • Model (e.g. iPhone 11 Pro Max): iPhone 14 Pro* Model (e.g. iPhone 11 Pro Max): iPhone 14 Pro
  • Is it an emulator? Yes* Is it an emulator? Yes

Additional Context

I found this issue while working this one 5-stones/react-native-readium#11 (comment). You can read that if you want some more context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions