Skip to content

Commit a65fec5

Browse files
Merge pull request #72 from wavemaker/dev-ponnarasi/path-params
Removed path params from base path
2 parents fa1d888 + aa9ba65 commit a65fec5

8 files changed

Lines changed: 17 additions & 10 deletions

dist/config-import-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/config-import-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/log.bundle-sizes.rest-import-ui.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ process: 5.29 KB (0.0473%)
3333
scheduler: 4.33 KB (0.0387%)
3434
@emotion/is-prop-valid: 4.33 KB (0.0387%)
3535
deep-extend: 4.19 KB (0.0375%)
36-
base64-js: 3.84 KB (0.0344%)
36+
base64-js: 3.84 KB (0.0343%)
3737
@mui/styled-engine: 3.55 KB (0.0318%)
3838
@mui/private-theming: 3.5 KB (0.0314%)
3939
css.escape: 3.08 KB (0.0275%)

dist/rest-import-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rest-import-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wavemaker/rest-client-ui",
3-
"version": "0.0.19",
3+
"version": "0.0.20",
44
"private": false,
55
"main": "./dist/core/components/RestImport.js",
66
"release": {

src/core/components/RestImport.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,14 @@ export default function RestImport({ language, restImportConfig }: { language: s
338338
const path = new URL(url).pathname; // Extract path from URL
339339
const parts = path.split("/").filter(Boolean); // Remove empty strings
340340

341-
const basePathDetails = parts.map((_, index) => decodeURIComponent("/" + parts.slice(0, index + 1).join("/")));
341+
// Stop at the first occurrence of `{}` placeholders
342+
const firstValidIndex = parts.findIndex(part => {
343+
const decodePart = decodeURIComponent(part)
344+
return decodePart.includes("{") || decodePart.includes("}")
345+
});
346+
const filteredParts = firstValidIndex === -1 ? parts : parts.slice(0, firstValidIndex);
347+
348+
const basePathDetails = filteredParts.map((_, index) => decodeURIComponent("/" + filteredParts.slice(0, index + 1).join("/")));
342349
if(basePathDetails.length > 0){
343350
setBasePath(restImportConfig?.urlBasePath ? restImportConfig?.urlBasePath : basePathDetails[0]);
344351
}
@@ -347,7 +354,7 @@ export default function RestImport({ language, restImportConfig }: { language: s
347354
console.error("Invalid URL:", error);
348355
setBasePathList([])
349356
}
350-
357+
351358
}
352359

353360
const updateProviderConfig = (key: string, value: any) => {

0 commit comments

Comments
 (0)