Skip to content

Commit

Permalink
chore: check for symbolic
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Nov 18, 2024
1 parent 8ce3f76 commit bd3479f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/services/includers/batteries/unarchive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {Headers, extract} from 'tar-stream';

import type {PassThrough} from 'stream';

import {getRealPath} from '@diplodoc/transform/lib/utilsFS';

import {IncluderFunctionParams} from '../../../models';

const name = 'unarchive';
Expand Down Expand Up @@ -87,10 +89,13 @@ async function includerFunction(params: IncluderFunctionParams<Params>) {

const contentPath = index === 0 ? join(writeBasePath, input) : join(readBasePath, input);

const writePath = join(writeBasePath, output);
const writePath = getRealPath(join(writeBasePath, output));

if(!writePath.startsWith(writeBasePath)){
throw new UnarchiveIncluderError(`Invalid output parameter: ${output}. Provide includer with output parameter, which is located inside the documentation`, output);
if (!writePath.startsWith(writeBasePath)) {
throw new UnarchiveIncluderError(
`Expected the output parameter to be located inside project root, got: ${output}`,
output,
);
}

try {
Expand Down

0 comments on commit bd3479f

Please sign in to comment.