Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Plugin/Usage/FileUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public function __construct(
$this->wrappers[$key]['instance'] = $stream_wrapper_manager->getViaUri($key . '://');
}

// Ensure 'public' is processed before 'asset' in convertBasepathsToUris
// so base-path URIs resolve to public:// (the canonical form) and don't
// create duplicate file entities when both wrappers share the same path.
uksort($this->wrappers, fn($a, $b) => ($b === 'public') <=> ($a === 'public') ?: strcmp($a, $b));

// This regex now handles spaces in filenames.
$this->uriRegex = '/(?<!"preview_image":{"id":")((' . implode('|', array_keys($this->wrappers)) . '):\/\/(.*?)\.(.*?))([\s|:"*?<>|\\\\]|$)/m';
$this->mediaReferenceRegex = '/\[media-reference:file:(.*?)\]/m';
Expand Down