Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Last active April 30, 2019 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomsbg/c40805b0758f6593bfe7f26fb6dfc93d to your computer and use it in GitHub Desktop.
Save thomsbg/c40805b0758f6593bfe7f26fb6dfc93d to your computer and use it in GitHub Desktop.
diff --git a/app/mixins/controllers/shared/legacy_urls.rb b/app/mixins/controllers/shared/legacy_urls.rb
index 0a8d96f8fb3..5c2aabe92c3 100644
--- a/app/mixins/controllers/shared/legacy_urls.rb
+++ b/app/mixins/controllers/shared/legacy_urls.rb
@@ -66,8 +66,11 @@ module Mixins::Controllers::Shared::LegacyUrls
# many apologies to my past and future selves!
unless url
if LegacySlug.community_has_legacy_slugs?(current_community)
- if legacy_slug = LegacySlug.for_community_and_slug(current_community, request.path.gsub(/^\//, ""))
+ path = request.path.gsub(/^\//, "")
+ if legacy_slug = LegacySlug.for_community_and_slug(current_community, path)
url = url_for(legacy_slug.entry)
+ elsif path.start_with?(PartnerPlatform.google_amp_prefix) && legacy_slug = LegacySlug.for_community_and_slug(current_community, path.sub(/^#{PartnerPlatform.google_amp_prefix}/, ""))
+ url = url_for(:controller => "partner_platform", :action => "google_amp", :slug => legacy_slug.entry.slug)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment