Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

IA Pages - find the correct IA regardless of letter casing in the URL #1392

Merged
merged 3 commits into from Jun 8, 2016

Conversation

MariagraziaAlastra
Copy link
Member

@MariagraziaAlastra MariagraziaAlastra commented Jun 6, 2016

Description :

Redirect to the correct IA Page even if the meta_id in the URL contains uppercase chars.
new-blank

Reviewer notes :

How to test this manually:

  • manually type a single IA Page URL containing one or more uppercase letters. Does it load the correct IA Page?
  • Now type the URL for the same IA Page, but using the lowercase meta_id. Does it still load the correct IA Page?
References issues / PRs:

Who should be informed of this change?

@tagawa @russellholt

Does this change have significant privacy, security, performance or deployment implications?
Checklist :
  • Back end tests (perl, scripts)
  • Front end tests (js, integration)
  • Browser verification
    • IE
    • Chrome
    • Firefox
    • Safari
    • Opera
  • Mobile verification
    • iOS
    • Android

@MariagraziaAlastra MariagraziaAlastra changed the title IA Pages - find the correct IA regardless of URL letter casing IA Pages - find the correct IA regardless of letter casing in the URL Jun 6, 2016
@@ -595,7 +595,7 @@ sub ia_base :Chained('base') :PathPart('view') :CaptureArgs(1) { # /ia/view/cal
my ( $self, $c, $answer_id ) = @_;

$c->stash->{ia_page} = "IAPage";
$c->stash->{ia} = $c->d->rs('InstantAnswer')->find({meta_id => $answer_id});
$c->stash->{ia} = $c->d->rs('InstantAnswer')->find({meta_id => lc $answer_id});
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we absolutely sure there are no mixed case meta_ids in existing data?

Copy link
Member Author

Choose a reason for hiding this comment

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

We shouldn't... but I'm starting to have doubts now!

Copy link
Contributor

Choose a reason for hiding this comment

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

You can do something like this to be extra sure.

https://github.com/duckduckgo/community-platform/blob/65368f8/script/ddgc_revokeadmin.pl#L18

my $user = $schema->resultset('User')->search( \[ 'LOWER(me.username) = ?', ( lc($username) ) ] )->one_row;

Thanks!

@MariagraziaAlastra
Copy link
Member Author

@jbarrett Thanks, changes made!

@jbarrett jbarrett merged commit 1ae6c40 into dev-ia-pages Jun 8, 2016
@jbarrett jbarrett deleted the maria/lc_ids branch June 8, 2016 14:52
@jbarrett
Copy link
Contributor

jbarrett commented Jun 8, 2016

👍 Thanks, @MariagraziaAlastra!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants