Skip to content

Commit b1ab536

Browse files
authored
Fix urlparse in analytics breaking on wonky URLs (#12558)
1 parent cde1c87 commit b1ab536

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

readthedocs/analytics/proxied_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,16 @@ def increase_page_view_count(self, project, version, absolute_uri, status):
104104
if version and version.is_external:
105105
return
106106

107-
absolute_uri_parsed = urlparse(absolute_uri)
107+
try:
108+
absolute_uri_parsed = urlparse(absolute_uri)
109+
except ValueError as e:
110+
log.info(
111+
"Skipping page view count due to URL parsing error",
112+
url=absolute_uri,
113+
error=str(e),
114+
)
115+
return
116+
108117
try:
109118
unresolved = unresolver.unresolve_url(absolute_uri)
110119
filename = unresolved.filename

0 commit comments

Comments
 (0)