Skip to content

Uses URL constructor to reliably generate the url - #25

Open
msjonker wants to merge 1 commit into
sayem314:masterfrom
msjonker:url-fix
Open

Uses URL constructor to reliably generate the url#25
msjonker wants to merge 1 commit into
sayem314:masterfrom
msjonker:url-fix

Conversation

@msjonker

@msjonker msjonker commented Jun 5, 2020

Copy link
Copy Markdown

This fixes the form submit URL when the request is not to the root path. Using the lastIndexOf "/" will get the last directory, but it always needs to be the root. So, for example, if the page being attempted is https://bouqs.com/flowers/all and the action is /flowers/all, the existing code would generate https://bouqs.com/flowers/flowers/all. The URL constructor can intelligently generate the URL from a given base: https://nodejs.org/api/url.html#url_constructor_new_url_input_base

@msjonker msjonker mentioned this pull request Jan 5, 2021
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.

1 participant