Remove component docs server image path hack

This hack was needed back when we didn't unify how we loaded images in
CSS; we now do via the `var(--image-file-X)` approach that generates
correct relative images. Therefore we can lose this hack in the
component docs :)

Bug: none
Change-Id: I98ec7d21437aa280d7a33ecd4fae64f59bfba83b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2794950
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/scripts/component_server/server.js b/scripts/component_server/server.js
index bcbaad8..f9ad231 100644
--- a/scripts/component_server/server.js
+++ b/scripts/component_server/server.js
@@ -202,25 +202,6 @@
   }
 }
 
-/**
- * In Devtools-Frontend we load images without a leading slash, e.g.
- * var(--image-file-checker). This works within devtools, but breaks this component
- * server as the path ends up as /component_docs/my_component/Images/checker.png.
- * So we check if the path ends in Images/*.* and if so, remove anything before
- * it. Then it will be resolved correctly.
- */
-function normalizeImagePathIfRequired(filePath) {
-  const imagePathRegex = /\/Images\/(\S+)\.(\w{3})/;
-  const match = imagePathRegex.exec(filePath);
-  if (!match) {
-    return filePath;
-  }
-
-  const [, imageName, imageExt] = match;
-  const normalizedPath = path.join('front_end', 'Images', `${imageName}.${imageExt}`);
-  return normalizedPath;
-}
-
 async function requestHandler(request, response) {
   const filePath = parseURL(request.url).pathname;
   if (filePath === '/favicon.ico') {
@@ -273,9 +254,7 @@
 
   } else {
     // This means it's an asset like a JS file or an image.
-    const normalizedPath = normalizeImagePathIfRequired(filePath);
-
-    let fullPath = path.join(componentDocsBaseFolder, normalizedPath);
+    let fullPath = path.join(componentDocsBaseFolder, filePath);
     if (fullPath.endsWith(path.join('locales', 'en-US.json'))) {
       // Rewrite this path so we can load up the locale in the component-docs
       fullPath = path.join(componentDocsBaseFolder, 'front_end', 'i18n', 'locales', 'en-US.json');