Skip to content

don't use url_parse module #12

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { mime } from "https://cdn.deno.land/mimetypes/versions/v1.0.0/raw/mod.ts"
import { urlParse } from 'https://cdn.deno.land/url_parse/versions/1.0.0/raw/mod.ts';
import { basename } from "https://deno.land/std@0.92.0/path/mod.ts";

export async function readImageFromURL(url: string): Promise<{ bytes: Uint8Array; name: string; }> {
Expand All @@ -8,7 +7,7 @@ export async function readImageFromURL(url: string): Promise<{ bytes: Uint8Array
const imageBytes = new Uint8Array(await response.arrayBuffer());

const extension = mime.getExtension(mimeType as string);
const defaultName = basename(urlParse(url).pathname)
const defaultName = basename(new URL(url).pathname)
let defaultImageName = defaultName

// if image name does NOT include an extension
Expand Down