SEO + AEO on AutopilotFrom the team at Stackmatix
The Growth Library

Test Download Filenames Across Headers and Link Markup

Test Content-Disposition filename and UTF-8 filename* alongside origin-aware download attributes,visible labels and independent file identity.

A download URL, a visible link label and a saved filename can disagree without changing the file’s bytes. Before repairing a download experience, identify which response header or link attribute supplies the suggested name. Do not mistake a filename change for a new release asset or a canonical decision.

The release artifact review establishes approved file identity. This check establishes the browser-facing filename contract for that artifact. A helpful label should tell a reader what arrived without silently renaming an unrelated file.

The example uses harmless fictional text content. It does not download or execute software, change a real asset or assert that every browser must use exactly the same filesystem name.

Define the complete fictional resource contract

Assume the approved public file contains this single UTF-8 line:Team worksheet revision A. Its actual resource URL is https://downloads.example/assets/a17.txt. The visible link label is Team worksheet, TXT. The owner wants a readable French suggested filename while preserving an ASCII fallback.

The complete relevant response headers are:

Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="worksheet.txt"; filename*=UTF-8''cahier-%C3%A9quipe.txt

The extended value represents cahier-équipe.txt. The percent-encoded sequence represents the UTF-8 bytes of the accented character;it is not a literal percent string the publisher intends readers to see in the decoded suggested name. The response body remains the same approved harmless file.

Use a populated origin-aware case table

Keep the page origin, target origin, response disposition and link attribute in one record. These cases specify the intended controlled browser test, not universal guarantees about every client.

CaseLink and responseExpected distinction
ACross-origin target;attachment header printed above;download="link-name.txt"Response instructs attachment;extended header name is the expected supported-client preference
BSame-origin target;Content-Disposition:inline with no filename;download="link-name.txt"Honored attribute can request download and suggest link-name.txt
CCross-origin target;inline response with no filename;download="link-name.txt"Do not assume attribute forces a download;ordinary navigation can occur
DSame-origin attachment;filename="worksheet.txt";download="link-name.txt"Header filename takes precedence over the attribute name

The same-origin cases require the actual page and target to share the relevant origin. A similar brand name or sibling subdomain is not enough. Record scheme, host and port rather than guessing from the visible URL label.

Inspect a download event rather than its markup alone

Use an authorized local browser fixture with the exact harmless body and headers. Capture the requested URL, final response, the browser’s reported suggested filename and the received file bytes where a download occurs. Compare the bytes with the approved reference independently of the name.

For the cross-origin inline case, record whether the browser navigates rather than emitting a download event. A missing event is not automatically a broken file;it may be the documented attribute boundary. Keep a bounded observation and actual navigation evidence instead of assuming all clients behave identically.

Do not inspect only the HTMLAnchorElement.download property. MDN notes that filesystem-name adjustment is not observable through that property. It records the declared suggestion, not necessarily the final adjusted name a user’s platform will save.

Keep malformed and unsafe names out of the source record

Choose filenames from the publisher’s approved asset manifest. Do not concatenate an arbitrary visitor-supplied string into a response header. The real implementation needs its normal header-safety and input-validation controls;this publication check does not replace them.

Retain a local negative with an invalid extended encoding and require the generator’s validation to reject it before release. Add another with directory separators or control characters in a proposed filename. The publisher should have an explicit supported-name policy rather than relying on a browser to repair every input.

Also test a contradictory visible label. A link promising a worksheet should not deliver a different guide merely because both have valid filenames. Name parsing, body identity and the link’s reader promise remain three separate assertions.

Do not turn the filename into a search signal

A Content-Disposition label does not make the file canonical to another resource. The HTML/PDF canonical review explicitly separates that relationship from a download name. Keep any HTTP Link canonical decision under its own approved resource policy.

Likewise, a correct name does not prove transport completeness. The byte-range response check covers resumed transfer behavior. A name can remain unchanged while a partial response is wrong, or change while the approved bytes remain identical.

When a release moves the resource URL, preserve the asset identity and update the actual public references. Do not rename every downloaded file simply to make an internal storage path look tidy.

Release a bounded filename result

The receipt should contain the approved file reference, visible label, exact response fields, origin context, browser version, suggested-name result and independent body comparison. Mark cases without an actual download separately from naming failures.

Approve the implementation when its supported clients receive a coherent suggestion and the correct file, with malformed inputs rejected under the publisher’s real validation policy. Keep untested platforms visible as limitations rather than claiming universal filename behavior.

The useful outcome is a reader who can recognize the intended deliverable. It does not establish file safety, canonical selection, indexing or a guarantee that every operating system will preserve every suggested character unchanged.

Sources

Matt Pru

Co-founder and CEO of Stackmatix. Writing about growth, customer acquisition, and the decisions behind useful marketing. Connect on LinkedIn.

Developed with AI assistance under Matt's editorial direction. Our Editorial Approach