Skip to content

Commit

Permalink
Fix dangerous URL composition rule. (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon authored Feb 13, 2025
1 parent b992c57 commit 3135ef0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samchon/openapi",
"version": "2.4.2",
"version": "2.4.3",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down
8 changes: 4 additions & 4 deletions src/http/HttpMigrateRouteFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ const _Propagate = async (
) as any;

// DO REQUEST
const path: string =
props.connection.host[props.connection.host.length - 1] !== "/" &&
props.route.path[0] !== "/"
const resolvedPath: string =
props.connection.host.endsWith("/") === false &&
props.route.emendedPath.startsWith("/") === false
? `/${getPath(props)}`
: getPath(props);
const url: URL = new URL(`${props.connection.host}/${path}`);
const url: URL = new URL(`${props.connection.host}${resolvedPath}`);

const response: Response = await (props.connection.fetch ?? fetch)(url, init);
const status: number = response.status;
Expand Down

0 comments on commit 3135ef0

Please sign in to comment.