Skip to content

Commit 5c7791d

Browse files
committed
fix
1 parent 4dd0c42 commit 5c7791d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

extensions/detect-unused-media-extension.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ function extractMediaReferences(contentCatalog, logger) {
7070
file.contents.toString().match(/(image|video)::?(\S+?)(?:\[|$)/gm) || [];
7171
mediaMatches.forEach((match) => {
7272
let imagePath = match.replace(/(image|video)::?/g, "").replace(/\[.*$/, "").trim();
73-
73+
7474
// Skip if this looks like a Docker image reference (contains / or ends with version tag)
7575
// Docker images are typically like: "cimg/base:2021.04" or "python:3.6.3"
7676
if (imagePath.match(/^[a-z0-9-]+\/[a-z0-9-]+:|^[a-z0-9-]+:[0-9]/)) {
7777
return; // Skip Docker images
7878
}
79-
79+
8080
mediaReferences.add(imagePath);
8181
});
8282
}
@@ -129,15 +129,15 @@ function findUnusedMedia(
129129
const relativePathWithoutImagesDir = relativePath.replace(/^images\//, '');
130130
const moduleQualifiedPathWithoutImagesDir = img.src.module + ":" + relativePathWithoutImagesDir;
131131
const componentQualifiedPathWithoutImagesDir = img.src.component + ":" + img.src.module + ":" + relativePathWithoutImagesDir;
132-
133-
const isUsed =
132+
133+
const isUsed =
134134
mediaReferences.has(relativePath) ||
135135
mediaReferences.has(moduleQualifiedPath) ||
136136
mediaReferences.has(componentQualifiedPath) ||
137137
mediaReferences.has(relativePathWithoutImagesDir) ||
138138
mediaReferences.has(moduleQualifiedPathWithoutImagesDir) ||
139139
mediaReferences.has(componentQualifiedPathWithoutImagesDir);
140-
140+
141141
if (!isUsed) {
142142
unusedMedia.add(img);
143143
logger.warn(

0 commit comments

Comments
 (0)