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

Count link redirects #14

Merged
merged 3 commits into from
Aug 28, 2020
Merged

Count link redirects #14

merged 3 commits into from
Aug 28, 2020

Conversation

turbaszek
Copy link
Owner

Related to #2

Copy link
Collaborator

@janusz-chludzinski-zz janusz-chludzinski-zz left a comment

Choose a reason for hiding this comment

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

👌
One minor remark regarding naming things :)

@@ -92,6 +93,15 @@ func redirectHandler(w http.ResponseWriter, r *http.Request) {
return
}

// To avoid redirect loop
if link.URL == link.ID {
http.Error(w, "Link id must be different than url", http.StatusBadRequest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Link id is, IMHO, bit confusing. As a user I would probably confused what this ID is. As far as I understand now id is url part provided by the user? If so, I'd recommend changing it to something like value or something similar :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good suggestion! I've renamed it and added some comments to structs

Copy link
Collaborator

@janusz-chludzinski-zz janusz-chludzinski-zz left a comment

Choose a reason for hiding this comment

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

Nice one!

@@ -92,6 +92,15 @@ func redirectHandler(w http.ResponseWriter, r *http.Request) {
return
}

// To avoid redirect loop
if link.URL == link.Value {
http.Error(w, "Alternative url value must be different than the url", http.StatusBadRequest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@turbaszek turbaszek merged commit 2021b43 into master Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants