Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Archive data is corrupt when not truncated #515

Closed
mojavelinux opened this issue Jun 14, 2019 · 0 comments
Closed

Archive data is corrupt when not truncated #515

mojavelinux opened this issue Jun 14, 2019 · 0 comments

Comments

@mojavelinux
Copy link
Contributor

The archive data becomes corrupt if the server doesn't truncate it. That's because the getArchiveJson function is returning a JSON object in one case (when truncated) and a string otherwise. In the case it returns a string, it gets spread into another JSON object, which leads to corrupt data.

The function should look like this:

function getArchiveJson (archive) {
  if (archive.truncated) {
    return fetch(archive.raw_url).then(resp => resp.json())
  }
  return JSON.parse(archive.content)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant