Fixing path extraction
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-08-02 22:39:05 +02:00
parent 4aaee3e419
commit 2d6c62a791
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,6 @@ export default async function render(
name: string, name: string,
data: any data: any
): Promise<Deno.Reader> { ): Promise<Deno.Reader> {
console.log(config);
const component: { const component: {
default: () => JSX.IntrinsicElements | Promise<JSX.IntrinsicElements>; default: () => JSX.IntrinsicElements | Promise<JSX.IntrinsicElements>;
} = await import(`./views/${name}.tsx`); } = await import(`./views/${name}.tsx`);

View File

@ -74,7 +74,7 @@ export function extractPackagePath(path: string): [string, string | undefined] {
if (parts.length > 2) throw new Error("Invalid package name!"); if (parts.length > 2) throw new Error("Invalid package name!");
packageName += parts[0]; packageName += parts[0];
let packageVersion: string | undefined = path[1]; let packageVersion: string | undefined = parts[1];
if (!isValidPackageName(packageName)) if (!isValidPackageName(packageName))
throw new Error("Invalid package name!"); throw new Error("Invalid package name!");
@ -96,6 +96,7 @@ export async function getFile(
version: string | null | undefined, version: string | null | undefined,
file: string file: string
): Promise<{ etag: string; data: Uint8Array } | null | undefined> { ): Promise<{ etag: string; data: Uint8Array } | null | undefined> {
console.log("Searching for file: %s/%s@%s", pkgName, file, version);
const meta = await db.package.findOne({ name: pkgName }); const meta = await db.package.findOne({ name: pkgName });
if (!meta || meta.versions.length < 1) return null; if (!meta || meta.versions.length < 1) return null;