Split URL with optional <alias> in two
@@ -48,13 +48,26 @@ from readthedocs.proxito.views.utils import fast_404
DOC_PATH_PREFIX = getattr(settings, 'DOC_PATH_PREFIX', '')
urlpatterns = [
- # Serve downloads
+ # Serve project downloads
+ # /_/downloads/<lang>/<ver>/<type>/
url(
(
- # /_/downloads/<lang>/<ver>/<type>/
+ r'^{DOC_PATH_PREFIX}downloads/'
+ r'(?P<lang_slug>{lang_slug})/'
+ r'(?P<version_slug>{version_slug})/'
+ r'(?P<type_>[-\w]+)/$'.format(
+ DOC_PATH_PREFIX=DOC_PATH_PREFIX,
+ **pattern_opts)
+ ),
+ ProjectDownloadMedia.as_view(same_domain_url=True),
+ name='project_download_media',
+ ),
+ # Serve subproject downloads
# /_/downloads/<alias>/<lang>/<ver>/<type>/
+ url(
+ (
r'^{DOC_PATH_PREFIX}downloads/'
- r'(?:(?P<subproject_slug>{project_slug})/)?'
+ r'(?P<subproject_slug>{project_slug})/'
r'(?P<lang_slug>{lang_slug})/'
r'(?P<version_slug>{version_slug})/'
r'(?P<type_>[-\w]+)/$'.format(
