GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fetching files renders invalid blob · Issue #145 · developit/unfetch

fetching files renders invalid blob #145

New issue
Copy link
New issue
Copy link
Open
#169
Open
fetching files renders invalid blob#145
#169
Copy link

Description

@skourismanolis
skourismanolis
opened on Oct 28, 2020
Issue body actions

How it should be

let e = await fetch('https://i.imgur.com/4AiXzf8.jpg')
// Response { type: "cors", url: "https://i.imgur.com/4AiXzf8.jpg", redirected: false, status: 200, ok: true, statusText: "OK", headers: // Headers, body: ReadableStream, bodyUsed: false }
await e.blob()
// Blob { size: 87363, type: "image/jpeg" }

How it is with unfetch

let e = await fetch('https://i.imgur.com/4AiXzf8.jpg')
// Object { ok: true, statusText: "OK", status: 200, url: "https://i.imgur.com/4AiXzf8.jpg", text: text(), json: json(), blob: blob(), clone: a(), headers: {…} }
await e.blob()
// Blob { size: 156997, type: "" }

Note how the blob's size is different and the type is missing.

That can also be confirmed by using FileReader.readAsDataURL() on the generated blob, the resulting file is invalid and cannot be opened.

Reacted by ELFrontEnd

Activity

  1. kg-currenxie commented on Dec 9, 2020

    @kg-currenxie
    kg-currenxie
    on Dec 9, 2020
    More actions

    Same :/

  2. qqilihq commented on Feb 15, 2021

    @qqilihq
    qqilihq
    on Feb 15, 2021
    More actions

    Any workarounds or attempts to fix this?

    The issue is obviously here:

    https://github.com/developit/unfetch/blob/master/src/index.mjs#L16

    To fix this, the XHR would probably need to be initialized with the proper responseType, which at first glance will require some deeper refactoring of the current structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.