Skip to content

Commit

Permalink
Fix cli utils - isUrl returns true for "file://" (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitom18 authored Apr 27, 2021
1 parent 84adbff commit 640e81e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolve } from "../deps.ts";

/** Helper function for path parsing.
*
* If the first element starts with `http` or `https` it will return the first element.
* If the first element starts with `http` or `https` or `file` it will return the first element.
* Else, the path will be prefixed by `file://` and resolved.
*/
export const parsePath = (...path: string[]): string => {
Expand All @@ -14,9 +14,7 @@ export const parsePath = (...path: string[]): string => {
};

export const isUrl = (path: string) => {
if (path?.startsWith("http://") || path?.startsWith("https://")) {
return true;
}

return false;
return path.startsWith("http://")
|| path.startsWith("https://")
|| path.startsWith("file://")
};

0 comments on commit 640e81e

Please sign in to comment.