Skip to content

Commit a6cf9b0

Browse files
kgowruKapil GowruKapil Gowru
authored
07 23 redirects 13 (#118)
Co-authored-by: Kapil Gowru <[email protected]> Co-authored-by: Kapil Gowru <[email protected]>
1 parent 9e93164 commit a6cf9b0

File tree

5 files changed

+1973
-1424
lines changed

5 files changed

+1973
-1424
lines changed

check_urls.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,17 @@ def follow_redirect_chain(self, url):
8282
# Make request without following redirects automatically
8383
response = self.session.get(current_url, timeout=self.timeout, allow_redirects=False)
8484

85-
# Check if this step leads to home page
86-
if self.is_home_page(current_url):
87-
return {
88-
'status_code': response.status_code,
89-
'final_url': current_url,
90-
'redirect_chain': redirect_chain,
91-
'redirect_count': redirect_count,
92-
'leads_to_home': True,
93-
'home_at_step': redirect_count,
94-
'error': None
95-
}
96-
97-
# If not a redirect, we're done
85+
# If not a redirect, we're done - check final destination for home page
9886
if response.status_code not in [301, 302, 303, 307, 308]:
87+
# Check if final destination is home page
88+
is_home = self.is_home_page(current_url)
9989
return {
10090
'status_code': response.status_code,
10191
'final_url': current_url,
10292
'redirect_chain': redirect_chain,
10393
'redirect_count': redirect_count,
104-
'leads_to_home': False,
105-
'home_at_step': None,
94+
'leads_to_home': is_home,
95+
'home_at_step': redirect_count if is_home else None,
10696
'error': None
10797
}
10898

@@ -142,26 +132,41 @@ def follow_redirect_chain(self, url):
142132
'home_at_step': None,
143133
'error': f'Redirect loop detected at step {redirect_count}'
144134
}
135+
136+
# Check if this intermediate redirect step leads to home page
137+
if self.is_home_page(current_url):
138+
return {
139+
'status_code': response.status_code,
140+
'final_url': current_url,
141+
'redirect_chain': redirect_chain,
142+
'redirect_count': redirect_count,
143+
'leads_to_home': True,
144+
'home_at_step': redirect_count,
145+
'error': None
146+
}
145147

146-
# Too many redirects
148+
# Too many redirects - check if final URL is home page anyway
149+
is_home = self.is_home_page(current_url)
147150
return {
148151
'status_code': None,
149152
'final_url': current_url,
150153
'redirect_chain': redirect_chain,
151154
'redirect_count': redirect_count,
152-
'leads_to_home': False,
153-
'home_at_step': None,
155+
'leads_to_home': is_home,
156+
'home_at_step': redirect_count if is_home else None,
154157
'error': f'Too many redirects (>{self.max_redirects})'
155158
}
156159

157160
except requests.exceptions.RequestException as e:
161+
# Check if we ended up at home page even with an error
162+
is_home = self.is_home_page(current_url)
158163
return {
159164
'status_code': None,
160165
'final_url': current_url,
161166
'redirect_chain': redirect_chain,
162167
'redirect_count': redirect_count,
163-
'leads_to_home': False,
164-
'home_at_step': None,
168+
'leads_to_home': is_home,
169+
'home_at_step': redirect_count if is_home else None,
165170
'error': str(e)
166171
}
167172

fern/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ redirects:
270270
permanent: true
271271
# General SDK capabilities pattern (will catch any not specifically overridden above)
272272
- source: /learn/sdks/capabilities/:slug*
273-
destination: /learn/sdks/overview/capabilities/:slug*
273+
destination: /learn/sdks/overview/introduction
274274
permanent: true
275275

276276
# SDK Reference redirects

fern/products/docs/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ navigation:
172172
path: ./pages/authentication/sso.mdx
173173
- page: Role based access control (RBAC)
174174
path: ./pages/authentication/rbac.mdx
175+
slug: rbac
175176
- page: API Key Injection
176177
path: ./pages/api-references/autopopulate-api-key.mdx
177178
- section: Enterprise

fern/products/sdks/sdks.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ navigation:
121121
- changelog: ./overview/ruby/changelog
122122
- page: Publishing to RubyGems
123123
path: ./overview/ruby/publishing-to-rubygems.mdx
124+
slug: publishing-to-rubygems
124125
- page: Adding custom code
125126
hidden: true
126127
path: ./overview/ruby/custom-code.mdx

0 commit comments

Comments
 (0)