Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rce in url parsing #14

Merged
merged 2 commits into from Apr 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev
remove url from fetch repo
closes #13
  • Loading branch information
p-mcgowan committed Apr 4, 2022
commit baeb727b60991ad82d9e63ac660883793abc0acc
6 changes: 3 additions & 3 deletions src/lib/file-utils.ts
Expand Up @@ -162,7 +162,7 @@ export const fetchSource = async (pathlike: string, options?: SourceOptions): Pr

const cache = getCacheDir(url);
if (!sourceCache[cache?.path]) {
sourceCache[cache?.path] = isRecipeFile(url.pathname) ? fetchRecipe(url, cache, options) : fetchRepo(url, cache, options);
sourceCache[cache?.path] = isRecipeFile(url.pathname) ? fetchRecipe(url, cache, options) : fetchRepo(cache, options);
} else {
logger.log(`cache hit on ${cache?.path}`);
}
Expand Down Expand Up @@ -237,7 +237,7 @@ export const fetchRecipe = async (url: URL, cacheInfo: CacheInfo, options?: Sour
*
* @return {Promise<string>} The repo.
*/
export const fetchRepo = async (url: URL, cacheInfo: CacheInfo, options?: SourceOptions): Promise<string> => {
export const fetchRepo = async (cacheInfo: CacheInfo, options?: SourceOptions): Promise<string> => {
let branch = cacheInfo.branch;
const { path: repo, origin, repoName } = cacheInfo;

Expand All @@ -247,7 +247,7 @@ export const fetchRepo = async (url: URL, cacheInfo: CacheInfo, options?: Source
return repo;
}

logger.debug({ url, branch, repo, origin });
logger.debug({ branch, repo, origin });
logger.info(`will clone ${branch ? `${logger.blu(branch)} of ` : ''}${logger.ylw(origin)} into ${logger.grn(repoName)}`);

const cwd = repo;
Expand Down