diff --git a/lib/imgbundler/imgbundler.go b/lib/imgbundler/imgbundler.go index 2c3bce289..7dbd6268e 100644 --- a/lib/imgbundler/imgbundler.go +++ b/lib/imgbundler/imgbundler.go @@ -166,7 +166,7 @@ func worker(ctx context.Context, l simplelog.Logger, inputPath string, href []by var err error if isRemote { l.Debug(fmt.Sprintf("fetching %s remotely", string(href))) - buf, mimeType, err = httpGet(ctx, html.UnescapeString(string(href))) + buf, mimeType, err = httpGet(ctx, l, html.UnescapeString(string(href))) } else { l.Debug(fmt.Sprintf("reading %s from disk", string(href))) path := html.UnescapeString(string(href)) @@ -181,8 +181,15 @@ func worker(ctx context.Context, l simplelog.Logger, inputPath string, href []by if mimeType == "" { mimeType = sniffMimeType(href, buf, isRemote) + l.Debug(fmt.Sprintf("no mimetype provided - sniffed MIME type for %s: %s", string(href), mimeType)) + } else { + l.Debug(fmt.Sprintf("mimetype provided for %s: %s", string(href), mimeType)) } mimeType = strings.Replace(mimeType, "text/xml", "image/svg+xml", 1) + if mimeType == "application/octet-stream" && bytes.Contains(buf, []byte("