diff --git a/src/paperless/urls.py b/src/paperless/urls.py index 16169309b..43ba5eb49 100755 --- a/src/paperless/urls.py +++ b/src/paperless/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import include, url from django.contrib import admin from django.urls import path +from django.views.decorators.csrf import csrf_exempt from django.views.generic import RedirectView from rest_framework.authtoken import views from rest_framework.routers import DefaultRouter @@ -41,6 +42,21 @@ # The Django admin url(r"admin/", admin.site.urls), + # These redirects are here to support clients that use the old FetchView. + url( + r"^fetch/doc/(?P\d+)$", + RedirectView.as_view(url='/api/documents/%(pk)s/download/'), + ), + url( + r"^fetch/thumb/(?P\d+)$", + RedirectView.as_view(url='/api/documents/%(pk)s/thumb/'), + ), + url( + r"^fetch/preview/(?P\d+)$", + RedirectView.as_view(url='/api/documents/%(pk)s/preview/'), + ), + url(r"^push$", csrf_exempt(RedirectView.as_view(url='/api/documents/post_document/'))), + # Frontend assets TODO: this is pretty bad. path('assets/', RedirectView.as_view(url='/static/assets/%(path)s')),