Skip to content
Faith Forge LabsJordan

Repair a download link whose file was released too early

A failed download does not always mean the export data is wrong. The application can produce the intended bytes and still offer a link that no longer refers to them.

This fictional investigation concerns a staff export generated in an owned browser application. The supported test setup shows a valid result in memory, a visible Download link and a failure when the reviewer clicks that link. The cause lies in the lifetime of its temporary URL.

Export E-41 contains the agreed records for request group G-6, including reference R-18. The reviewer inspects the generated content before downloading and confirms its expected identity. The file format and record content are not the disputed boundary.

The application creates a blob URL for the export and puts it in the link's destination. A cleanup step then revokes that URL during the render sequence, even though the interface continues to offer the link. The later click attempts to use a reference that the application has already released.

The trace for the inspected setup is:

Sequence State
Create E-41 content Correct G-6/R-18 export bytes exist
Create temporary URL U-41 U-41 refers to E-41
Render Download link Link destination is U-41
Run cleanup immediately U-41 is revoked; link remains visible
Reviewer clicks later The offered URL can no longer be resolved

The source records remain correct. Rebuilding the reporting system or changing the export encoding would not repair that ownership sequence.

Choose a supported lifetime

The W3C File API draft describes object-URL creation and revocation as creating and removing a reference to the underlying object. A request made after revocation cannot rely on that mapping. The application therefore needs to keep the URL while the current interface still offers it.

The chosen repair assigns ownership to the export-result view. It creates a URL for the current result and retains it during ordinary rerenders. When a new export replaces the result, the old link is removed or updated so it no longer offers the previous URL; the previous URL can then be released. When the view is disposed, its remaining URL is released as part of that lifecycle.

This is not a rule to keep every generated URL forever. Retaining unused references wastes resources. It is a rule to align disposal with the interface that still needs the reference.

Verify the current export and its replacement

With the repair, E-41 remains available through the offered U-41 link. The reviewer downloads it in the supported test setup and checks G-6 and R-18 in the receiving file. Successful creation of a filename alone would not establish that the right export arrived.

The reviewer then generates E-42 for group G-7 containing R-23. The view presents the new U-42 link and no longer offers U-41. After the old link has been removed, the application releases U-41. Downloading through the current link produces G-7/R-23, not the previous result.

An unrelated rerender of the current view leaves U-42 usable. Disposing the view releases U-42 and removes its link. The sequence does not leave a visible action whose destination has already been revoked.

Keep the conclusion within the evidence

The investigation establishes that premature revocation caused this failure in the specified application and test setup. It does not claim that every browser exposes the same symptom at every timing boundary, or that the application can observe when an operating system has finished saving a download.

The repair does not use an arbitrary short delay as proof of download completion. It follows the supported ownership of the current result and its interface. Any implementation must verify that lifecycle in the actual framework and supported browsers.

Record the decision to repair

The organisation retains the working export generation and reporting records. The changed scope is the result-view lifecycle, its cleanup and the acceptance cases for successive exports. A full replacement is unnecessary for the demonstrated fault because the relevant source is owned and the supported correction is available.

Handover records who owns each generated URL, when a link stops offering it and which content identifiers the reviewer checks. That explanation helps a later maintainer avoid reintroducing immediate cleanup while trying to tidy resource management.

Discuss a reproducible failure · Read the existing-system repair service