Last active
April 30, 2019 19:56
-
-
Save thomsbg/c40805b0758f6593bfe7f26fb6dfc93d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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