Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated port in absolute path #381

Merged

Conversation

dew326
Copy link
Contributor

@dew326 dew326 commented Apr 6, 2020

Fixed issue: #379

It makes sure that the port is not duplicated.

@@ -294,14 +294,17 @@ class Router {
});
// Foo-bar!
url = this.context_.base_url + url;

const isPortInHost = host.indexOf(':' + port) > -1 || this.getHost() && this.getHost().indexOf(':' + port) > -1;
Copy link

Choose a reason for hiding this comment

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

The code could be simplified (ans the performance improved) by storing the result of host || this.getHost() in a variable, and reusing it everywhere.
Same for (isPortInHost || '' === port ? '' : ':' + port)

This is not 100% related to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, this could be optimized and I would be happy to do it, but I'm not a fan of doing refactors without the maintainer's approval. I know how this may complicate merging up patches from the lower version to current and overall maintenance.

@dunglas
Copy link

dunglas commented Apr 14, 2020

I confirm that this patch fixes the issue.

@tobias-93
Copy link
Collaborator

Hi @dew326, thank you for contributing!
The remark @dunglas makes is valid, it will be taken account if (ever) this bundle is refactored.
For now I will merge this patch to fix the broken behavior for some of our users.

@tobias-93 tobias-93 merged commit c16a9a6 into FriendsOfSymfony:master Apr 15, 2020
@dew326 dew326 deleted the fix-duplicated-port-in-absolute-path branch April 15, 2020 09:18
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.

3 participants