Repository navigation
Description
HydePHP media copying in v3 (Deep Research)
Abstract
HydePHP has historically used a configurable list of file extensions to determine which files are copied from the _media directory to _site/media.
For HydePHP v3, I want to reconsider whether that allow-list still provides enough value to justify its complexity. Since _media is already a directory specifically intended for public assets, should Hyde simply copy everything placed there?
A possible middle ground would be to copy all files while excluding a small set of known junk or placeholder files, such as .gitkeep, .DS_Store, Thumbs.db, and AppleDouble ._* files.
This document evaluates the costs and benefits of each approach and recommends the behavior that makes the most sense for HydePHP v3.
Background
In HydePHP v2 and earlier, Hyde used MediaFile::EXTENSIONS to determine which files in _media qualified as media files and should be copied into _site/media.
The default extension list contained:
png, svg, jpg, jpeg, webp, gif, ico, css, js
Users could extend or replace this list through the hyde.media_extensions configuration option.
This provided a clear definition of what Hyde considered a media file, but it also meant that files outside the configured list were silently excluded from the generated site. Legitimate static assets such as PDFs, fonts, JSON files, web manifests, source maps, and downloadable archives therefore required additional configuration.
HydePHP v3 is currently being developed on the master branch. This gives us an opportunity to reconsider the old behavior without introducing a breaking change into an existing stable release.
Recommendation
For HydePHP v3, _media should become a true passthrough directory:
Recursively copy all files from
_mediato_site/media.Exclude a small set of known junk and placeholder files.
Allow users to configure additional exclusion patterns.
Stop using
MediaFile::EXTENSIONSas the primary rule for deciding which files are copied.
The directory itself should define publication intent:
Everything placed in
_mediais public unless it is explicitly excluded.
There was value in the extension constant, particularly as a guardrail against accidentally publishing unrelated files. However, that value was limited in a directory already dedicated to publishable assets. The allow-list also introduced recurring costs through unexpected behavior, documentation requirements, configuration discovery, and maintenance whenever new asset types became common.
Existing user expectations
Hyde’s documentation has consistently described _media as the location for static assets that are copied into the generated site.
This creates a straightforward user expectation:
Put a file in
_media, and Hyde will publish it under_site/media.
An extension allow-list weakens that contract. A user can place a valid asset in the correct directory and still find that it was not copied because Hyde did not recognize its extension.
That behavior is especially surprising for common static assets such as:
PDF documents
Font files such as
.woff,.woff2, and.ttfWeb manifests
JSON data files
Source maps
Text files
Downloadable archives
The user should not need to discover an advanced configuration option before Hyde will copy an otherwise ordinary static file.
Comparable public-directory models
The closest comparison to Hyde’s _media directory is the public or static directory used by other static-site generators.
Tools such as Astro and Hugo treat these directories as passthrough locations. Files placed there are copied into the generated site without being restricted to a predefined set of extensions.
This works because the directory name already communicates the contract: its contents are intended for publication.
Jekyll takes a more exclusion-oriented approach because it processes a broader source tree containing both public files and internal project files. It therefore needs additional include and exclude rules.
Hyde’s _media directory is already isolated from the rest of the project. It does not need the same defensive filtering as a generator that scans a mixed source directory.
Eleventy requires users to configure passthrough copy rules explicitly. Hyde already provides _media as a built-in convention, so requiring additional declarations would add configuration without improving the common case.
For Hyde, the Astro and Hugo model is the most relevant: a dedicated public directory should copy arbitrary files by default.
Cost-benefit analysis
Option 1: Keep the extension allow-list
Under this option, Hyde would continue copying only files whose extensions appear in MediaFile::EXTENSIONS or hyde.media_extensions.
Benefits
Prevents many unrelated files from being published accidentally.
Automatically filters common operating-system metadata and placeholder files.
Provides a narrow and explicit definition of what Hyde considers media.
Preserves existing behavior and configuration semantics.
Costs
Legitimate static assets are silently ignored unless their extensions are configured.
Users must learn about an advanced option to publish ordinary files.
The default list requires maintenance as frontend asset types evolve.
Documentation must explain that
_mediadoes not necessarily copy everything.The behavior conflicts with the natural interpretation of a dedicated public-assets directory.
Extension-based file discovery adds implementation complexity.
A file’s extension is not always a reliable indicator of whether it should be public.
The allow-list provides protection, but it optimizes for accidental misuse of _media rather than its intended use.
Option 2: Copy everything
Under this option, Hyde would recursively copy every file from _media into _site/media.
Benefits
Provides the simplest possible mental model.
Supports all current and future asset types automatically.
Matches the documented purpose of
_media.Removes the need to maintain a media-extension registry.
Eliminates configuration for common files such as PDFs and fonts.
Produces behavior consistent with other dedicated public-directory systems.
Makes the implementation easier to understand and test.
Costs
Placeholder files such as
.gitkeepmay be published.Operating-system metadata such as
.DS_StoreandThumbs.dbmay be published.Users who treat
_mediaas general storage may unintentionally expose files.Version-control metadata could be copied if it somehow exists inside
_media.
This option has the strongest developer experience, but publishing obvious junk files would make the generated output unnecessarily messy.
Option 3: Copy everything with explicit exclusions
Under this option, Hyde would recursively copy all files except those matching a small exclusion list.
Benefits
Preserves the simple passthrough-directory model.
Supports arbitrary asset types without additional configuration.
Prevents common junk and placeholder files from being published.
Allows advanced users to exclude project-specific files or directories.
Avoids maintaining an ever-growing registry of valid extensions.
Makes publication rules explicit and easy to explain.
Better aligns the implementation with the purpose of
_media.
Costs
Requires a small amount of exclusion-matching logic.
The default exclusion list must be maintained.
An obscure junk file not included in the defaults could still be copied.
Changes to the existing configuration model require migration documentation.
This option provides most of the simplicity of copying everything while preserving the useful protection offered by the old allow-list.
Comparison
Option | Developer experience | Legitimate asset support | Junk-file protection | Maintenance burden | Ecosystem fit -- | -- | -- | -- | -- | -- Keep the extension allow-list | Low | Medium | High | High | Low Copy everything | High | High | Low | Low | High Copy everything with exclusions | High | High | High enough | Low to medium | HighCopying everything with a small explicit exclusion list provides the best overall balance.
Proposed v3 behavior
HydePHP v3 should:
Treat
_mediaas a recursive passthrough directory.Copy all files regardless of extension.
Skip a small default set of known junk files.
Introduce a configurable exclusion list, such as
hyde.media_exclude.Deprecate or remove
hyde.media_extensionsas a file-discovery mechanism.
A possible default configuration could look like this:
'media_exclude' => [
'.gitkeep',
'.DS_Store',
'Thumbs.db',
'._*',
'.git/**',
'.hg/**',
'.svn/**',
],
The exact pattern syntax would need to be defined, but it should support both filenames and recursive paths.
Default exclusions
The default list should remain intentionally small.
Good candidates include:
.gitkeep
.DS_Store
Thumbs.db
._*
.git/
.hg/
.svn/
These files have little or no legitimate purpose in generated website output.
Hyde should not exclude every dotfile by default. Unlike a general project source directory, _media is specifically intended for publication. Some hidden files may be intentionally public, and excluding all of them would recreate the same surprise caused by the extension allow-list.
The rule should therefore be:
Exclude known junk, not broad categories of potentially valid files.
Why .gitignore should not control publication
Hyde could technically reuse .gitignore rules when deciding which media files to copy, but this should not be the default.
.gitignore describes source-control policy. It does not necessarily describe publication policy.
A file may be excluded from Git because it is generated locally while still needing to be published. Conversely, a file may be tracked in Git but intentionally excluded from the generated site.
Using a dedicated media_exclude setting keeps these concerns separate and makes Hyde’s behavior easier to understand.
Support for .gitignore-aware exclusions could be introduced later as an explicit opt-in feature, but it should not define the default behavior.
Validation behavior
Changing _media to a passthrough directory does not require weakening Hyde’s asset validation.
Hyde can continue validating explicitly referenced assets and throwing a helpful FileNotFoundException when a referenced file does not exist.
These are separate concerns:
Passthrough copying determines which files are eligible to be published.
Asset validation determines whether an explicitly referenced file exists.
Allowing arbitrary file types in _media only broadens publication support. It does not prevent Hyde from reporting missing assets clearly.
Implementation outline
The implementation can remain simple:
Recursively enumerate files under the configured media directory.
Normalize each path relative to the
_mediaroot.Test the relative path against the default and configured exclusions.
Create the corresponding parent directory under
_site/media.Copy each remaining file.
Laravel’s filesystem utilities or Symfony Finder can both support this model cleanly.
The implementation should avoid extension-based glob patterns. Direct recursive enumeration followed by explicit filtering is easier to understand, more portable, and easier to test.
Suggested tests
The v3 test suite should verify that:
Existing image, CSS, and JavaScript files continue to copy.
Files outside the old allow-list are copied.
Nested files preserve their directory structure.
Default junk files are skipped.
Custom exclusion rules work recursively.
Legitimate dotfiles can still be published.
Empty directories do not need to be reproduced unless explicitly required.
Explicitly referenced missing assets continue to produce helpful errors.
Example files should include:
docs/manual.pdf
fonts/app.woff2
data/site.json
manifest.webmanifest
downloads/example.zip
nested/assets/example.txt
Default exclusion tests should include:
.gitkeep
.DS_Store
Thumbs.db
._logo.png
.git/config
.hg/store/example
.svn/entries
Migration strategy
The cleanest v3 migration would be to replace extension-based discovery entirely.
Documentation should describe _media in plain language:
All files in
_mediaare copied to_site/media, except files matching the configured exclusion rules.
Any documentation presenting media_extensions as the normal way to enable additional static files should be removed or updated.
There are two possible compatibility approaches.
Clean break
Remove hyde.media_extensions from copy discovery in v3.
This is the clearest option and is appropriate for a major release. Existing projects would generally gain support for more files rather than lose functionality.
The main observable difference would be that previously ignored files might now be copied unless explicitly excluded.
Transitional deprecation
Continue reading hyde.media_extensions temporarily while emitting a deprecation notice explaining that _media now uses passthrough semantics.
This provides a softer migration path, but it may also make the behavior harder to explain. It would need to be clear whether the extension setting still filters files, is ignored, or is translated into another rule.
Unless there is a significant compatibility concern, the clean break is preferable.
Conclusion
MediaFile::EXTENSIONS provided a useful guardrail in earlier versions of HydePHP, but it is not the best default publication model for v3.
Because _media is already a dedicated public-assets directory, the most intuitive rule is that files placed there should be published. Restricting publication by extension creates more friction and maintenance than value.
HydePHP v3 should therefore copy all files from _media recursively while excluding a small, explicit set of known junk and placeholder files. Additional exclusions should be configurable through a dedicated setting.
This gives Hyde a simple and durable contract:
Everything in
_mediais public unless explicitly excluded.
Activity
emmadesilva commentedon Jul 14, 2026
Had a coding agent ground in the codebase:
Verdict
The direction is right:
_mediashould behave as a passthrough directory in HydePHP v3. It better matches Hyde’s documentation, conventions, and “common things should work without configuration” philosophy.However, the proposal underestimates the implementation and migration costs. In particular:
MediaFileshould absolutely remain.I would approve the product direction, but revise the implementation plan before coding it.
MediaFileshould not be removedOnly
MediaFile::EXTENSIONSis tied to extension discovery.MediaFileitself is Hyde’s public static-asset value object. It provides:Hyde::asset(),Hyde::assets(),MediaFile::all(), andMediaFile::files()Those responsibilities are visible in MediaFile.php. PDFs, fonts, JSON, and archives can already be represented by
MediaFile; they are simply not auto-discovered.The correct change is therefore:
Renaming it to
AssetFilewould create broad API and documentation churn without solving anything. CSS and JavaScript already demonstrate that “media” is being used in Hyde’s broader static-asset sense.I would retain
MediaFile::EXTENSIONSas a deprecated, unused compatibility constant for v3. Existing published configuration directly references it in config/hyde.php. Removing the constant makes an unmodified upgrading application fail while loading configuration. Keeping it costs virtually nothing and allows removal in v4.What the actual pipeline looks like
Media discovery is shared infrastructure, not just a copying detail:
The allow-list itself is only this call in HasMediaFiles.php:
Consequently, “extension-based discovery adds implementation complexity” is overstated. The current mechanism is one configuration lookup passed to an existing generic finder. Copy-everything without exclusions would indeed be simpler; copy-everything with configurable glob exclusions is more code than the current allow-list.
The real benefit is reduced user-facing complexity and surprise, not a dramatic reduction in framework code.
Important side effects missing from the proposal
1. Most proposed defaults are already excluded
Hyde’s
FileFinderuses Symfony Finder in FileFinder.php. Symfony Finder ignores dotfiles and VCS directories by default:.gitkeep.DS_Store._*.git/.hg/.svn/They are already invisible even if Hyde stops filtering by extension.
Thumbs.dbis the only proposed default that would newly require explicit filtering.This creates an important choice:
findFiles(..., false, true)copies all non-hidden, non-VCS files.So the proposal’s default exclusion system is not just additive filtering—it changes Symfony’s hidden-file behavior too. Files such as
.env,.vite/manifest.json, and arbitrary hidden directories could become public unless considered carefully.VCS patterns do not need to be reimplemented; Symfony already excludes those directories independently.
2. Excluded assets currently validate but produce broken links
MediaFile::get()first looks in discovered assets, but falls back to constructing aMediaFilefor any existing source file:See MediaFile.php.
Therefore, with the proposed exclusions:
could pass existence validation and generate a
/media/private/report.pdfURL even though the file was excluded from the build.The document’s claim that validation can remain unchanged is thus incomplete. Missing-file validation remains intact, but publication validation does not.
The asset helper should reject explicitly referenced excluded assets with an actionable error, or the design must explicitly state that references override exclusions. Silently generating a broken link is not Hyde-like.
3. Arbitrary large files expose inefficient copying
The transfer task does not use a streaming filesystem copy. It loads each complete file into PHP memory and writes it back:
See TransferMediaAssets.php.
That is tolerable for CSS and normal images, but the proposal explicitly adds archives, PDFs, fonts, and potentially videos. A large downloadable archive could cause a significant memory spike.
This work should include switching to
Filesystem::copy($source, $target)and checking its result.4. Every discovered file can be hashed during Markdown processing
The Markdown link processor iterates over every discovered media file in DynamicMarkdownLinkProcessor.php. Its replacement construction calls
getLink(), which computes a cache-busting hash.Broad discovery can therefore cause every PDF or archive to be hashed even when the file is never referenced by an
<img>element. Combined with copying, some large assets may be read twice during a build.The processor should only resolve and hash an asset after confirming that the relevant source path occurs in the HTML. Ideally, it should also stop treating arbitrary downloads as candidate Markdown images.
5. Development and production policies can diverge
The realtime compiler serves files by directly checking
_media, bypassingMediaFile::all()and all discovery rules:See AssetFileLocator.php.
This has two consequences:
hyde servebut disappear from a production build. Passthrough fixes that existing inconsistency.media_exclude, an excluded file would still be served during development unless the realtime compiler adopts the same policy.A single publication-policy implementation needs to govern discovery, build copying, explicit asset references, and development serving. Custom configuration may require booting Hyde for media requests, which changes the realtime compiler’s current boot-free
/media/fast path.6. The dashboard becomes a general static-file library
The dashboard consumes
MediaFile::all(). It has a genericBINARYplaceholder for unknown extensions, so it will not fundamentally break. However, its UI still uses image-oriented labels, and its editor action explicitly rejects anything outside the old extension family in DashboardController.php.After this change, PDFs, fonts, archives, maps, and JSON files will appear in the “Media library,” usually with a
BINARYcard and a disabled/rejected edit action. That deserves a small dashboard UX pass, even if only to rename tooltips from “image” to “asset” and improve common placeholders.7. Symlink behavior should be defined
The proposal discusses accidentally publishing metadata but not symlinks. Directory symlinks are not followed by Symfony Finder by default, but file symlinks and paths resolving outside
_medianeed explicit tests.For a directory declaring “everything here is public,” a safe rule is:
Is the cost-benefit analysis valid?
Broadly, but not as written.
media_extensionsmay unexpectedly publish files. That is a potentially security-relevant migration.public/files are copied untouched, and Hugo saysstatic/is copied topublic/. Eleventy does require explicit passthrough registration, as the document states. Astro documentation, Hugo documentation.The comparison with Jekyll is also fair: its broader source tree copies ordinary static files but excludes specially named and hidden paths unless explicitly included. Jekyll documentation.
Will it still feel like Hyde?
Yes—more than the current behavior—provided the edge cases are made coherent.
“Put a static asset in
_media; Hyde publishes it” is exactly the sort of convention-over-configuration contract Hyde should have. The current documentation already promises this, while the implementation quietly narrows it.What would not feel like Hyde is:
hyde servebut not inhyde buildThe advanced
media_excludesetting is still Hyde-like because ordinary projects never need to touch it.Recommended v3 design
I would proceed with Option 3, with these adjustments:
MediaFileand all of its public asset API.MediaFile::EXTENSIONSfor discovery.media_extensionsfrom newly published configuration and document that existing settings no longer filter publication./paths for exclusions and precisely document basename versus path patterns..git/**,.hg/**, and.svn/**..gitkeep,.DS_Store,Thumbs.db, and._*.Filesystem::copy()rather than loading complete contents into memory.The migration guide also needs to address users who treated
media_extensionsas a security allow-list. A pure positive exclusion list cannot easily preserve “publish only PNG and JPG” unless the pattern language supports negation or an advanced include policy remains available.So: the proposal has the correct product conclusion, and it will feel more like Hyde. But this is a medium cross-cutting framework change, not merely deleting
EXTENSIONSand adding four filename checks.emmadesilva commentedon Jul 14, 2026
Follow up from ChatGPT after giving deep research chat the AI resonse
Yes. This materially corrects the original analysis.
The earlier recommendation reached the right product conclusion, but for the wrong-sized implementation model. Hyde is not copying an opaque directory tree; it is discovering
MediaFileobjects that feed several public and internal systems. The real decision is:Taking the code findings you supplied as accurate—I could not independently retrieve the current GitHub files in this session—the best answer is still directory-based publication, but implemented as a coordinated asset-system change.
Revised verdict
For HydePHP v3:
Keep
MediaFile.Make
_mediapassthrough-by-default for new projects.Replace extension-based discovery with a centralized, path-based publication policy.
Preserve current hidden-file and VCS behavior initially.
Keep
MediaFile::EXTENSIONSas deprecated compatibility API.Preserve the old
hyde.media_extensionsbehavior for upgraded projects when that configuration key is still present.Use exclusions only as an advanced publication policy, not as ad hoc checks in the copying task.
The extension constant has little remaining value as Hyde’s definition of a publishable asset. It does retain value temporarily for backward compatibility.
What the constant is actually buying today
The current extension list provides four benefits:
It limits the number of discovered objects.
It bounds hashing, dashboard enumeration, and Markdown-processing work.
It prevents arbitrary non-matching files from reaching the output.
It gives existing users a crude publication allow-list.
Only the fourth benefit is strategically important.
The performance benefits can be achieved more directly through lazy hashing, efficient copying, and better Markdown matching. The safety benefit is weak because
_mediais already documented and understood as a public-assets directory. An extension is not a reliable security classification anyway: a harmless-looking extension can contain sensitive data, while legitimate PDFs, fonts, maps, manifests, archives, and other downloads are currently omitted.The allow-list is therefore solving several secondary implementation problems by imposing friction on the primary user workflow.
Cost-benefit assessment
Approach | Common-case DX | Upgrade safety | Build performance | Internal complexity | Long-term fit -- | -- | -- | -- | -- | -- Keep extension allow-list | Low | High | Good | Low | Low Discover every file with no policy | High | Low | Potentially poor | Medium | Medium Passthrough with exclusions added separately to each subsystem | Medium | Medium | Mixed | Very high | Low Central publication policy, passthrough by default | High | High | Good after supporting changes | Medium-high | High Passthrough for new projects, legacy allow-list compatibility for upgrades | High | Highest | Good after supporting changes | High initially | HighestThe final option has the best overall outcome for v3.
Its implementation is larger, but most of that work is correcting existing coupling and development/production inconsistency rather than complexity intrinsic to passthrough publication.
Recommended architecture
Introduce one framework-level concept responsible for deciding whether a source asset is publishable. For example:
The exact class name is secondary. The important property is that the same policy governs:
Hyde::assets()andMediaFile::all()Build-time copying
Hyde::asset()andMediaFile::get()Realtime asset serving
Dashboard enumeration
Markdown asset rewriting
The publication rule should not be duplicated between these systems.
Default v3 policy
For new v3 projects:
Discover all regular files recursively.
Normalize paths relative to the configured media root.
Preserve Symfony Finder’s existing VCS exclusions.
Preserve current dotfile exclusion behavior.
Do not follow directory symlinks.
Preferably reject or skip all symlinks; at minimum, never accept a resolved target outside the media root.
Apply configured path exclusions.
Publish everything else.
Preserving current dotfile behavior is important. Enabling hidden-file discovery while changing extension discovery would combine two separate behavioral changes and could expose files that were never previously considered. Legitimate hidden assets can be addressed separately with an explicit, well-documented feature.
Because
.gitkeep,.DS_Store, and._*are already hidden, they do not need to be recreated in the default exclusion list. The useful defaults would likely be limited to visible OS noise such as:This also demonstrates why the exclusion list should not be the central justification for the change. Most of the anticipated exclusions are already handled by the underlying finder.
Migration behavior
This is the area where I would be more conservative than the research agent’s recommendation.
Ignoring an existing
hyde.media_extensionssetting during an upgrade could cause files that users intentionally kept out of production to become public. Even in a major release, unexpectedly publishing files is a worse migration failure than retaining legacy behavior.A safer v3 transition is:
New projects
The newly published configuration omits
hyde.media_extensions, so passthrough mode is used.Existing projects
When
hyde.media_extensionsis present in the application’s configuration, Hyde treats it as legacy allow-list mode and emits an actionable deprecation notice:This produces several advantages:
Existing projects do not silently publish additional files.
New projects immediately receive the better convention.
Users explicitly control when their project migrates.
No complex negation syntax is needed merely to preserve old allow-list behavior.
The constant and configuration can be cleanly removed in v4.
MediaFile::EXTENSIONSshould remain through v3 because existing application configuration may reference it while PHP loads the config file. Mark it deprecated and clarify that it is not Hyde’s authoritative list of supported assets.MediaFileremains essentialMediaFileis not merely a discovery result. It is the abstraction through which Hyde supplies:Normalized source and output paths
URLs
Existence checks
File metadata
Cache-busting
Asset collections and helpers
Removing or renaming it would create public API churn with no meaningful benefit.
The correct conceptual split is:
MediaFile: a static asset value objectMediaPublicationPolicy: whether that asset belongs in the generated siteCapability-specific checks: whether an asset can be previewed, edited, rewritten as an image, or otherwise processed
The current extension constant should not be reused for those capability checks. CSS and JavaScript in the list already demonstrate that it is not an image-support list. Dashboard editing and Markdown image rewriting should each define the exact capabilities they support.
Required supporting changes
1. Fix excluded asset validation
The publication policy must be checked by explicit asset resolution.
An excluded but existing file must not produce a valid-looking URL to a file that will never be built. The preferred behavior is an actionable exception, for example:
Explicit references should not override exclusions. Otherwise exclusions cease to describe the generated output reliably.
2. Stream or directly copy files
The transfer task should not read entire files into PHP strings.
Use the filesystem’s direct copy operation, verify its result, and report the source and destination when it fails. This is needed independently of discovery semantics, but passthrough publication makes the weakness much easier to encounter through videos, archives, PDFs, and other large downloads.
3. Make hashing lazy
Broad discovery should not mean broad hashing.
The Markdown processor should first determine whether an asset path is actually present in relevant HTML, and only then create a cache-busted link. Better still, it should extract image references and resolve those references rather than iterating over every asset.
For example, the order should effectively be:
The crucial detail is that
getLink()must not be evaluated before the cheap occurrence check.Arbitrary PDFs and ZIP files should not become candidate Markdown images merely because they are now discoverable.
4. Guarantee build/serve parity
The realtime compiler must use the same publication policy as the production build.
A file should never:
Work under
hyde servebut disappear underhyde buildBe excluded from production but remain accessible during development
Be rejected by
Hyde::asset()while still being directly servedIf booting the complete framework for every media request would damage the realtime compiler’s fast path, the policy can be initialized once and cached. The requirement is shared semantics, not necessarily shared runtime execution on every request.
5. Adjust dashboard terminology and capabilities
The dashboard will become an asset library containing images, fonts, documents, archives, data files, and source maps.
It does not need a major redesign, but it should:
Use “asset” rather than “image” where appropriate
Distinguish previewable and editable files
Avoid presenting an edit action that predictably throws
Provide recognizable placeholders for common document and font categories
6. Define symlink behavior
The least surprising v3 rule would be:
Supporting in-root file symlinks could be added later, but it creates platform differences and complicates containment guarantees. At an absolute minimum, resolved sources outside the media root must never be published.
Exclusion semantics
The exclusion language should remain deliberately small:
Patterns match normalized
/-separated paths relative to the media root.A basename pattern such as
Thumbs.dbmatches that filename at any depth.A path pattern such as
private/matches from the media root.Matching is deterministic across Windows and Unix.
Negation is not supported initially.
Excluded explicit references throw rather than silently produce broken links.
Negation becomes unnecessary for migration if legacy extension filtering remains available during v3.
The configuration could look like:
Suggested implementation order
Add the centralized publication policy while preserving current extension behavior.
Route discovery, asset lookup, copying, and realtime serving through it.
Add tests proving current behavior remains stable.
Add passthrough mode and exclusions.
Make passthrough the default when no legacy
media_extensionskey exists.Replace in-memory transfer with direct copying.
Make Markdown hashing and rewriting lazy.
Update dashboard capability handling.
Add migration documentation and deprecations.
This ordering prevents the behavioral change from being mixed with an untested architectural rewrite.
Minimum test matrix
The v3 change should prove:
PDF, JSON, WOFF2, ZIP, and nested arbitrary files are discovered and copied in passthrough mode.
Existing extension-filtered projects retain their current output.
Removing
media_extensionsenables passthrough behavior.Custom exclusions affect discovery, copying, helpers, dashboard results, and realtime serving equally.
Referencing an excluded file throws an actionable exception.
Missing files retain the current helpful failure behavior.
Hidden files and VCS directories retain their existing behavior.
Symlinks cannot publish content outside
_media.Large files are copied without calling
getContents().Unreferenced large assets are not hashed during Markdown processing.
Development and production expose the same asset set.
Custom source and output media directories still work.
MediaFile::EXTENSIONSremains accessible for old configuration files and is marked deprecated.Final recommendation
The product decision should be approved, but described accurately:
So, there is no compelling long-term value in
MediaFile::EXTENSIONSas the default publication boundary. Its value in v3 is compatibility and safe migration. The winning design is not “copy everything”; it is discover and publish everything intentionally placed in_media, consistently and efficiently, subject to one explicit policy.