From 52cb2576615e0ad26ad1af6c59575894bba84a66 Mon Sep 17 00:00:00 2001 From: Markos Gogoulos Date: Mon, 27 Apr 2026 12:59:49 +0300 Subject: [PATCH] push --- cms/version.py | 2 +- lti/urls.py | 1 + lti/views.py | 10 +++++++- templates/lti/media_not_found.html | 39 ++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 templates/lti/media_not_found.html diff --git a/cms/version.py b/cms/version.py index a9ef24c7..23a0dacd 100644 --- a/cms/version.py +++ b/cms/version.py @@ -1 +1 @@ -VERSION = "8.99921" +VERSION = "8.99922" diff --git a/lti/urls.py b/lti/urls.py index 0f4e947c..1c4ffa82 100644 --- a/lti/urls.py +++ b/lti/urls.py @@ -14,6 +14,7 @@ urlpatterns = [ path('jwks/', views.JWKSView.as_view(), name='jwks'), path('public-key/', views.PublicKeyPEMView.as_view(), name='public_key_pem'), path('select-media/', deep_linking.SelectMediaView.as_view(), name='select_media'), + path('media-not-found/', views.MediaNotFoundView.as_view(), name='media_not_found'), path('my-media/', views.MyMediaLTIView.as_view(), name='my_media'), path('embed//', views.EmbedMediaLTIView.as_view(), name='embed_media'), ] diff --git a/lti/views.py b/lti/views.py index d63ea28d..9cccf467 100644 --- a/lti/views.py +++ b/lti/views.py @@ -459,7 +459,7 @@ class LaunchView(View): base_url = reverse('lti:embed_media', args=[media.friendly_token]) return self.build_url_with_embed_params(base_url, embed_params) except Media.DoesNotExist: - pass + return reverse('lti:media_not_found') my_media_url = reverse('lti:my_media') + '?mode=lms_embed_mode' if custom.get('embed_share_media') == '0': @@ -677,6 +677,14 @@ class PublicKeyPEMView(View): ) +@method_decorator(xframe_options_exempt, name='dispatch') +class MediaNotFoundView(View): + """Shown when a media token from an LTI launch no longer exists.""" + + def get(self, request): + return render(request, 'lti/media_not_found.html', status=404) + + @method_decorator(xframe_options_exempt, name='dispatch') class MyMediaLTIView(View): """ diff --git a/templates/lti/media_not_found.html b/templates/lti/media_not_found.html new file mode 100644 index 00000000..d8afd331 --- /dev/null +++ b/templates/lti/media_not_found.html @@ -0,0 +1,39 @@ + + + + + + Media Not Found + + + +
+
🎬
+

Media does no longer exist

+
+ +