Skip to content

fix: use full encoded topic iri in streaming http receiveFrom url template#1935

Merged
joachimvh merged 2 commits intoCommunitySolidServer:mainfrom
elf-pavlik:fix/streaming-http-urls
Aug 19, 2024
Merged

fix: use full encoded topic iri in streaming http receiveFrom url template#1935
joachimvh merged 2 commits intoCommunitySolidServer:mainfrom
elf-pavlik:fix/streaming-http-urls

Conversation

@elf-pavlik
Copy link
Contributor

📁 Related issues

✍️ Description

I tried streaming HTTP notifications with the subdomain identifier strategy, which, of course, didn't work.
By using the topic's fully encoded IRI now, it should not assume any specific identifier strategy.

✅ PR check list

Before this pull request can be merged, a core maintainer will check whether

  • this PR is labeled with the correct semver label
    • semver.patch: Backwards compatible bug fixes.
    • semver.minor: Backwards compatible feature additions.
    • semver.major: Breaking changes. This includes changing interfaces or configuration behaviour.
  • the correct branch is targeted. Patch updates can target main, other changes should target the latest versions/* branch.
  • the RELEASE_NOTES.md document in case of relevant feature or config changes.
  • any relevant documentation was updated to reflect the changes in this PR.

Copy link
Member

@joachimvh joachimvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I added some minor comments I should have caught the first time actually.

const resourcePath = input.metadata.identifier.value.replace(this.baseUrl, '');
const receiveFrom = `${this.baseUrl}${this.pathPrefix}${resourcePath}`;
const encodedUrl = encodeURIComponent(input.metadata.identifier.value);
const receiveFrom = `${this.baseUrl}${this.pathPrefix}${encodedUrl}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this last time, but when generating URLs you want to use the joinUrl utility function instead of concatenating strings. This reduces the chance of errors, if someone didn't add a slash to the end of their base URL for example.

Also if baseUrl only gets used like this you could just store joinUrl(baseUrl, pathPrefix) in a variable in the constructor instead of storing both separately and combining every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, I added the changes! Since now it only appends the full URL to the end; I could define an InteractionRoute in the config and pass it to both components.

@elf-pavlik elf-pavlik requested a review from joachimvh August 14, 2024 17:52
Copy link
Member

@joachimvh joachimvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@joachimvh joachimvh merged commit 3e8365b into CommunitySolidServer:main Aug 19, 2024
@elf-pavlik elf-pavlik deleted the fix/streaming-http-urls branch August 19, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants