From 68ba25543b2ea3e1e4ccb679d1544f34ee27a51e Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Sun, 16 Feb 2020 19:07:32 -0500 Subject: [PATCH] Fix url generation for recursive files. --- src/model/struct/model/module/file.struct.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model/struct/model/module/file.struct.ts b/src/model/struct/model/module/file.struct.ts index 9e05e43..39b2fc5 100644 --- a/src/model/struct/model/module/file.struct.ts +++ b/src/model/struct/model/module/file.struct.ts @@ -4,7 +4,7 @@ import { Type, Module } from 'helios-distribution-types' import { resolve as resolveURL } from 'url' import { ModuleStructure } from './module.struct' import { readdir, stat } from 'fs-extra' -import { join, resolve } from 'path' +import { join, resolve, sep } from 'path' export class MiscFileStructure extends ModuleStructure { @@ -46,7 +46,7 @@ export class MiscFileStructure extends ModuleStructure { return name } protected async getModuleUrl(name: string, path: string, stats: Stats): Promise { - return resolveURL(this.baseUrl, join(this.relativeRoot, name)) + return resolveURL(this.baseUrl, join(this.relativeRoot, ...path.substr(this.containerDirectory.length+1).split(sep))) } protected async getModulePath(name: string, path: string, stats: Stats): Promise { return path.substr(this.containerDirectory.length+1).replace(/\\/g, '/')