Skip to content

[Bug]: PDF and image URL captures can overwrite an earlier file #4393

Closed

Description

@oleksii-tumanov

Pre-flight checks

  • I have checked the Troubleshooting section in the README.

What happened?

Adding two PDF or image URLs that produce the same sanitized filename writes both downloads to one corpus path. For example, URLs with the same host and .pdf path but different query strings select the same destination. The second successful capture replaces the first file's bytes, and both calls report that path. I expect both captures to remain available at distinct paths, with each returned path naming its own saved bytes.

This is supported by the v8 source: the filename uses the URL host and path, omits the query, and the PDF and image routes write directly to that filename. I have not run the example below against Graphify.

Steps to reproduce

The following is a deterministic local example using mocked validation and downloads. It does not make a network request. Run it from a source checkout with Graphify installed:

python - <<'PY'
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import patch
import graphify.ingest as ingest_mod

first_url = "https://example.org/report.pdf?revision=one"
second_url = "https://example.org/report.pdf?revision=two"
payloads = {first_url: b"first PDF", second_url: b"second PDF"}

with TemporaryDirectory() as directory:
    target = Path(directory)
    with patch.object(ingest_mod, "validate_url"), patch.object(
        ingest_mod, "safe_fetch", side_effect=lambda url: payloads[url]
    ):
        first = ingest_mod.ingest(first_url, target)
        second = ingest_mod.ingest(second_url, target)
    print(first.name, second.name)
    print(first.read_bytes())
    print(sorted(path.name for path in target.iterdir()))
PY

The image route uses the same binary writer; two .png URLs with a shared host/path and different queries have the same naming collision.

Error output or graph output

No command output or graph was captured. The source predicts the following final three lines for the mocked PDF example, after its download status messages (filename is path-sanitized), because both calls select example_org_report_pdf.pdf and the second write replaces its contents:

example_org_report_pdf.pdf example_org_report_pdf.pdf
b'second PDF'
['example_org_report_pdf.pdf']

There is no exception to warn that the first capture was replaced.

Graphify version

v8 source at release 0.9.88. This is a source inspection, not an installed runtime reproduction.

Operating System

macOS (inspection host only)

Python Version

3.13 (inspection host reports 3.13.5; no Graphify run)

Installation Method

Source checkout, not installed. The closest form category is built from source (git clone), but no build or installation was performed.

Additional Environment Details

Source inspection only; no provider configuration, clean-checkout run, or network fetch was used. The example patches both URL validation and fetching.

Additional context

This report concerns successful sequential PDF and image captures with colliding derived names. It does not assert that concurrent captures or a file replaced between checking and writing are protected.

Activity

  1. github-actions commented on Oct 13, 2026

    @github-actions

    Thanks for opening this issue, @oleksii-tumanov. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. added a commit that references this issue on Oct 13, 2026
    750b564
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions