hazel icon indicating copy to clipboard operation
hazel copied to clipboard

Can't access update/win32/:version/RELEASES

Open jordanmosakowski opened this issue 5 years ago • 4 comments

Updating on MacOS works fine, but on Windows I get the error "Remote release File is empty or corrupted." I'm pretty sure that the error is because of not being able to access /update/win32/:version/RELEASES. When I do this the page just doesn't load and redirect to the previous url I was at.

jordanmosakowski avatar Jun 03 '19 23:06 jordanmosakowski

We're having the same issue. Windows app won't update because of this.

saadzafar avatar Feb 05 '20 12:02 saadzafar

I fixed this issue myself by updating the cacheReleaseList function in the cache.js file as follows:

  async cacheReleaseList(url) {
    const { token } = this.config;
    const headers = { Accept: "application/vnd.github.preview" };

    if (token && typeof token === "string" && token.length > 0) {
      headers.Authorization = `token ${token}`;
    }

    const res = await retry(
      async () => {
        const response = await fetch(url, { headers });
        let buffer = await response.buffer();

        if (response.status !== 200) {
          throw new Error(
            `Tried to cache RELEASES, but failed fetching ${url}, status ${status}`
          );
        }

        return await buffer.toString("utf-8");
      },
      { retries: 3 }
    );

    const content = res;
    const matches = content.match(/[^ ]*\.nupkg/gim);

    if (matches.length === 0) {
      throw new Error(
        `Tried to cache RELEASES, but failed. RELEASES content doesn't contain nupkg`
      );
    }

    const nuPKG = url.replace("RELEASES", matches[0]);
    return content.replace(matches[0], nuPKG);
  }

The response from Github API is an octet stream and needs to be buffered and then needs to be decoded using utf-8.

I hope this helps and the dev team adds it to the next update.

saadzafar avatar Feb 06 '20 06:02 saadzafar

Hello, Was this ever fixed? It seems that I have the same issue and I don't know what to do. Thanks in advance!

busybox11 avatar Dec 23 '21 17:12 busybox11

Sharing what worked for me: https://github.com/vercel/hazel/issues/79#issuecomment-1010293920

wobedi avatar Jan 11 '22 19:01 wobedi