[bug] fetchModel fails when host and cqPath is passed
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Inspect fetchModel.ts at line 58 and reproduce fetchModel({ cqPath, host }) with the provided URL example. Done means the formed URL retains https:// and fetchModel successfully downloads the JSON, matching the issue's expected behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
fetchModel functions failes to get the model when host and cqPath are passed as the url formed to fetch is incorrect
Package version
v2.1.0
To Reproduce
Steps to reproduce the behavior:
- invoke fetchModel({
cqPath,
host
})
where cqPath can be any path which can give json
and host where this can be used
example : fetch('https:/api.mockfly.dev/mocks/1a7495c9-1442-415f-b55c-5f5b3a2ed5f4/my-iqos-header.model.json')
Expected behavior
The fetch url should be correctly formed and work as expected to download json
in fetchModel.ts at line 58
const hostURL = sanitizeUrl(${host}/${path}).replace(//+/g, '/'); is the one causing the problem of replacing https:// to http:/ and due to which fetch for model.json fails
Better to replace this with
const fullUrl = new URL(cqPath, host).toString(); which gives the correct url
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
- Dominant language
- TypeScript
- Stars
- 68
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from adobe/aem-react-editable-components
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
feature-request
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
feature-request
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
adobe/aem-react-editable-components#235 · 1 comment ·
All issues in adobe/aem-react-editable-components
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·