Skip to content

Commit

Permalink
chore: handle malformed source directories
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsMeBrianD committed Feb 13, 2025
1 parent b580ac8 commit ea3ad88
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/lib/sdk/src/plugins/datasources/writeSourceConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
import fs from 'fs/promises';
import { getSafeOptions, getSecretOptions } from './cli/edit/Options.js';
import { encodeBase64Deep } from '../../lib/b64Deep.js';
import { sourcesDirectory } from '../../lib/projectPaths.js';
import { projectRoot, sourcesDirectory } from '../../lib/projectPaths.js';

/**
*
Expand Down Expand Up @@ -36,7 +36,7 @@ export const writeSourceConfig = async (options, source, spinner) => {
yaml.stringify(encodeBase64Deep(secrets))
].join('\n');

if (!source.dir) {
if (!source.dir || !path.dirname(source.dir).startsWith(sourcesDirectory) || !path.isAbsolute(source.dir)) {
source.dir = path.join(sourcesDirectory, source.name);
}

Expand Down

0 comments on commit ea3ad88

Please sign in to comment.