adobe / helix-importer-ui

Apache License 2.0
20 stars 25 forks source link

[import] Report is not available if asset cannot be previewed #329

Closed kptdobe closed 4 months ago

kptdobe commented 4 months ago

Tightly coupled to #328: if an asset does not have a Preview (no html to render...), the code triggers an error and the report is not augmented with potential extra columns.

The following import.js shows the bug:

export default {
  transform: ({ document, url }) => {
    const result = [];
    const images = document.querySelectorAll('img');
    images.forEach((img) => {
      const u = new URL(img.src, url);
      const newPath = WebImporter.FileUtils.sanitizePath(u.pathname);
      const imgData = {
        path: newPath,
        from: img.src,
        report: {
          alt: img.getAttribute('alt'),
          naturalHeight: img.naturalHeight || img.height,
          naturalWidth: img.naturalWidth || img.width,
        }
      };
      result.push(imgData);
    });

    return result;
  },
};

The report is empty, the extra alt, naturalHeight and naturalWidth columns are also missing.

adobe-bot commented 4 months ago

:tada: This issue has been resolved in version 1.50.14 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: