Skip to content

zipcontent caches 404s for a year and omits remote_baseurl from the cache key #16154

Backlog

Description

@vtushar06

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: develop

Observed behavior

In kolibri/core/content/zip_wsgi.py (_zip_content_from_request, lines 374-401 on develop, 646b04dd), non-streaming responses are cached for a year (YEAR_IN_SECONDS). Two things look off:

  1. CACHE_KEY is only ZIPCONTENT_VIEW_RESPONSE_{zipped_filename}/{embedded_filepath}. remote_baseurl is omitted even though the same zip path can be served locally or from a peer.
  2. create_error_response returns a normal HttpResponse (404), not a StreamingHttpResponse. If the zip exists but an embedded file does not, that 404 gets stored with cache.set(..., YEAR_IN_SECONDS).

Expected behavior

Include remote_baseurl (and local vs. peer) in the cache key, and avoid caching 404 responses for a year so a file that becomes available later is not stuck as missing.

User-facing consequences

A learner can keep getting a cached 404 for a file added later, or receive a cached response from the wrong peer for the same zip path.

Steps to reproduce

  1. Open _zip_content_from_request in kolibri/core/content/zip_wsgi.py.
  2. Confirm CACHE_KEY only uses zipped_filename and embedded_filepath.
  3. Confirm get_embedded_file can return create_error_response (404 HttpResponse), which then hits cache.set(..., YEAR_IN_SECONDS).

Context

Kolibri version: develop (646b04dd)

Activity

  1. added theissue type on Dec 3, 2026
  2. added
    bug
    on Dec 3, 2026
  3. learning-equality-bot commented on Dec 3, 2026

    @learning-equality-bot
    Contributor

    📝 This issue doesn't follow one of our issue templates yet. It is closest to Report a bug. Please edit the description to fix:

    • ## AI usage is missing.

    The check runs again when you save, and this comment goes away once it passes. We review the issue after that. If it still doesn't follow a template in 7 days, it will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-template

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions