fix: uri encode usage inside getReadme #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
馃毃 Proposed changes
[[Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.]]
鈿欙笍 Types of changes
What types of changes does your code introduce? Put an
x
in the boxes that applyAdditional context
Hello world,
First of all, thank you for a great plugin!
I noticed unexpected behavior of the README.md component. I have a monorepo where each folder is a standalone component (terraform module in my case). I was able to successfully import modules to Backstage using Location (on the root level) and Component (spec type=library inside each folder)
As you can see, every module has its own README, and I was trying to pass the readme annotation:
This annotation was translated to following url:
and this request failed with 404. Upon checking Gitlab docs
https://docs.gitlab.com/ee/api/repository_files.html
I noticed that path must be URL encoded and correct URL would be like this:
(
/
->%2F
)However, it's not happening in the current plugin version.
When I tried to replace the annotation path with already encoded version, it was encoded again
resulting in the following cURL request:
Either approaches don't work correctly.
More context https://stackoverflow.com/questions/4540753/should-i-use-encodeuri-or-encodeuricomponent-for-encoding-urls
That said, I believe
encodeURIComponent
will serve the purpose and allow correct relative pathsThat's it!
Thank you <3