openzim / openzim/overview

Need a standardized approach for converting between ZIM-paths and URLs

Open
#92 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
HTML
Stars
9
Forks
2
PR merge metrics
No merged PRs in 30d

Description

The main purpose of ZIMs has been to store scraped website data and ZIM format allows paths looking like webpage addresses (with or without the host component).

Various openzim and kiwix projects (zim-tools, zimit, libkiwix, etc) have to convert between URLs and ZIM-paths and vice versa however there doesn't seem to be a single agreed upon method of doing that. As a result for certain edge cases the implementations in different projects can differ, leading to bugs.

An example

Consider that a scraper processes https://example.com/data/ and encounters the following resources under that root URI

A1) abc/de?f=12/34/5678
A2) abc/de?f=12/34/78
X) xyz

If the shown URL strings are used as ZIM-paths verbatim (without any encoding), what should be the URLs for referring to those articles?

URL for accessing A1 via a ZIM reader (to be appended to the full URI prefix):

  • abc/de?f=12/34/5678?
  • abc/de%3Ff=12/34/5678? (only ? is URI-encoded)
  • abc/de%3Ff=12%2F34%2F5678? (? and /s in the search component are URI encoded)

Relative URL for referring from A1 to A2:

  • ?f=12/34/78?
  • ./de?f=12/34/78?
  • ../78?
  • ./de%3Ff=12%2F34%2F5678?

Relative URL for referring from A1 to X:

  • ../xyz?
  • ../../../xyz?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the URL and ZIM-path handling in zim-tools, zimit, and libkiwix, starting with the A1, A2, and X examples in this issue. Establish one agreed rule for absolute and relative conversions, including encoding and path resolution, and document the expected results for each example.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.