scaffolder-backend: fix file path resolution for templates with a file location

Co-authored-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-02-19 14:51:14 +01:00
parent 79bc9626af
commit d0ed25196c
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Fixed file path resolution for templates with a file location
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { resolve as resolvePath } from 'path';
import { resolve as resolvePath, dirname } from 'path';
import { JsonValue } from '@backstage/config';
import { TemplateEntityV1alpha1 } from '@backstage/catalog-model';
import { Logger } from 'winston';
@@ -39,7 +39,7 @@ export function templateEntityToSpec(
let url: string;
if (protocol === 'file') {
const path = resolvePath(location, template.spec.path || '.');
const path = resolvePath(dirname(location), template.spec.path || '.');
url = `file://${path}`;
} else {