fix(unsplash): merge query params with src #712
Merged
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.
Edits done: Edited the provider for Unsplash, added a new case to the playground for Unsplash
Hi everyone, I found out that when using URLs which already contains query parameters, the provider will wrongly attach a '?' instead of using a & before the applied operations and Unsplash would ignore the first passed operation.
In these cases, placing a & would be the correct option.
I think another workaround would be to always place a '&' after '?' Like this:
?&
but I don't think is elegant.Here's an example of one generate url wrong:
https://images.unsplash.com/photo-1532236204992-f5e85c024202?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwxOTgwMDZ8MHwxfHNlYXJjaHwyOHx8dG9reW98ZW58MHx8fHwxNjczNzk3MDIz&ixlib=rb-4.0.3&q=80?w=300&q=80
The wrong part:
&q=80?w=300&q=80
Here's how it should appear correctly generated: https://images.unsplash.com/photo-1532236204992-f5e85c024202?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwxOTgwMDZ8MHwxfHNlYXJjaHwyOHx8dG9reW98ZW58MHx8fHwxNjczNzk3MDIz&ixlib=rb-4.0.3&q=80&w=300&q=80
The corrected part:
&q=80&w=300&q=80
And this is the source url: https://images.unsplash.com/photo-1532236204992-f5e85c024202?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwxOTgwMDZ8MHwxfHNlYXJjaHwyOHx8dG9reW98ZW58MHx8fHwxNjczNzk3MDIz&ixlib=rb-4.0.3&q=80
I tried it in the playground and it works.
I'm open to edit it if there's a better way of doing it.