Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolution bug WRT to filename extensions #1784

Closed
ry opened this issue Feb 15, 2019 · 3 comments
Closed

Resolution bug WRT to filename extensions #1784

ry opened this issue Feb 15, 2019 · 3 comments

Comments

@ry
Copy link
Member

ry commented Feb 15, 2019

Example:

import { serve } from "http://evbogue.com:8989/blobs/get/&CNnGcLf0eX1KPtq1t4GjU7jR24Q1bwuD5FRXT2x8U7U=.sha256";
const s = serve("0.0.0.0:8000");

async function main() {
  for await (const req of s) {
    req.respond({ body: new TextEncoder().encode("Hello World\n") });
  }
}

main();

fails with the error:

Downloading http://evbogue.com:8989/blobs/get/&CNnGcLf0eX1KPtq1t4GjU7jR24Q1bwuD5FRXT2x8U7U=.sha256...thread 'tokio-runtime-worker-2' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:355:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', libcore/result.rs:1009:5

which I think is because the filename is .sha256 instead of .ts.

reported here

@manyuanrong
Copy link
Contributor

This error occurs when the remote url does not provide a header for content-type. So should we assume by default that it is a TS file?

@kitsonk
Copy link
Contributor

kitsonk commented Feb 16, 2019

No, that feels very unsafe... We support extensions, followed by Content-Type. We support a wide array of common TypeScript media types, but supporting a lack of it, the file should be treated as suspicious, IMO. We support JavaScript, TypeScript and JSON at the moment, I am not sure "guessing" is a good idea.

@nayeemrmn
Copy link
Collaborator

@bartlomieju I believe this was fixed in #4030?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants