Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

context.request.path & context.request.url are incorrect for subdirectory strains #254

Closed
stevengill opened this issue Apr 12, 2019 · 4 comments · Fixed by #256
Closed
Assignees
Labels

Comments

@stevengill
Copy link

Related to adobe/helix-simulator#186.

I believe the context.request.path and context.request.url variables need to be updated to handle subdirectories.

Example Strain

  - name: contributor-docs-helixdemo
    <<: *basestrain
    url: https://adobedevsite.helix-demo.xyz/contributor/docs
    content: https://github.com/AdobeDocs/contributor.en.git/help#master
    directoryIndex: introduction.html
    package: developer-adobe-com/756ec092f2585c73ef0b75ba1caf8a698091d44a

variable values:

  • context.request.path = /contributor/docs/help/introduction.html
  • context.request.url = /contributor/docs/help/introduction.html
  • action.request.params.path = /help/introduction.md
  • action.request.params.rootPath = /contributor/docs

I believe the context.request.path/url should be /contributor/docs/introduction.html. action.request.params.path might also be wrong. Not sure if it should include the /help part.

@tripodsan
Copy link
Contributor

tripodsan commented Apr 12, 2019

correct. I think that the request.path and request.url should always be the one that is requested.

I think the problem is similar to HttpServletRequest.getPathInfo() in java. so we should probably add this.

so for a request to /contributor/docs/introduction.html above, it should yield:

property value
context.request.path /contributor/docs/introduction.html
context.request.rootPath1 /contributor/docs
context.request.pathInfo /introduction.html
action.request.params.path /help/introduction.md
(action.request.params.contentRoot)2 /help

1 I would move/duplicate this in the context.request for consistency
2 What's missing completely is the path of the repository mount. so maybe we need to add this, too

@tripodsan tripodsan transferred this issue from adobe/helix-simulator Apr 12, 2019
@tripodsan tripodsan self-assigned this Apr 12, 2019
@tripodsan
Copy link
Contributor

tripodsan commented Apr 12, 2019

quick fix would be to use the action.params.headers['x-old-url'] as request.path and x-repo-root-path for contentRoot, but probably better to include contentRoot and/or pathInfo directly in the action params.

@trieloff WDYT?

@tripodsan
Copy link
Contributor

tripodsan commented Apr 12, 2019

if the request to a directory, the request.path should also be the original one:

request to /contributor/docs/ with the strain above above, should yield:

property value
context.request.path /contributor/docs/
context.request.rootPath /contributor/docs
context.request.pathInfo '' (empty string)
action.request.params.path /help/introduction.md
action.request.params.contentRoot /help

tripodsan added a commit that referenced this issue Apr 12, 2019
tripodsan added a commit that referenced this issue Apr 12, 2019
trieloff pushed a commit that referenced this issue Apr 12, 2019
## [1.3.3](v1.3.2...v1.3.3) (2019-04-12)

### Bug Fixes

* **openwhisk:** context.request.path & context.request.url are incorrect for subdirectory strains ([#256](#256)) ([7fce752](7fce752)), closes [#254](#254)
@trieloff
Copy link
Contributor

🎉 This issue has been resolved in version 1.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

ramboz pushed a commit that referenced this issue Apr 15, 2019
ramboz pushed a commit that referenced this issue Apr 15, 2019
## [1.3.3](v1.3.2...v1.3.3) (2019-04-12)

### Bug Fixes

* **openwhisk:** context.request.path & context.request.url are incorrect for subdirectory strains ([#256](#256)) ([7fce752](7fce752)), closes [#254](#254)
ramboz pushed a commit that referenced this issue Apr 15, 2019
ramboz pushed a commit that referenced this issue Apr 15, 2019
## [1.3.3](v1.3.2...v1.3.3) (2019-04-12)

### Bug Fixes

* **openwhisk:** context.request.path & context.request.url are incorrect for subdirectory strains ([#256](#256)) ([7fce752](7fce752)), closes [#254](#254)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants