Skip to content

Commit

Permalink
fix: improve safety of asset path
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRivers committed Jan 10, 2025
1 parent 2736f56 commit 8acc264
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const version = packageVersion;
type KindePlaceholder = `@${string}@`;

const getAssetUrl = (assetPath: string, orgCode?: OrgCode) => {
if (!assetPath || assetPath.includes("..")) {
throw new Error("Invalid asset path");
}
return `/${assetPath}?${orgCode ? `p_org_code=${orgCode}&` : ""}cache=@8973ff883c2c40e1bad198b543e12b24@`;
};

Expand Down

0 comments on commit 8acc264

Please sign in to comment.