Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value Error on viewing NME videos with direct URL when Gloss WebView is set on True #1430

Open
rem0g opened this issue Dec 12, 2024 · 3 comments

Comments

@rem0g
Copy link
Collaborator

rem0g commented Dec 12, 2024

https://signbank.cls.ru.nl/dictionary/protected_media/glossvideo/NGT/30/300-B-48928_nme_0.mp4

I am getting value error when viewing the video on Incognitio mode or obtaining URL via signCollect intranet.

Environment:


Request Method: GET
Request URL: http://signbank.cls.ru.nl/dictionary/protected_media/glossvideo/NGT/30/300-B-48928_nme_0.mp4

Django Version: 4.2.16
Python Version: 3.12.2
Installed Applications:
('colorfield',
 'modeltranslation',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'django.contrib.staticfiles',
 'corsheaders',
 'reversion',
 'tagging',
 'guardian',
 'bootstrap3',
 'django_summernote',
 'signbank.dictionary',
 'signbank.feedback',
 'signbank.pages',
 'signbank.attachments',
 'signbank.video')
Installed Middleware:
('corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'signbank.pages.middleware.PageFallbackMiddleware',
 'reversion.middleware.RevisionMiddleware',
 'django.middleware.common.CommonMiddleware')



Traceback (most recent call last):
  File "/var/www/env/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/env/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/www/repo/signbank/dictionary/views.py", line 2275, in protected_media
    gloss_pk = int(filename.split('.')[-2].split('-')[-1])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: ValueError at /dictionary/protected_media/glossvideo/NGT/30/300-B-48928_nme_0.mp4
Exception Value: invalid literal for int() with base 10: '48928_nme_0'

@rem0g rem0g assigned rem0g, Woseseltops and susanodd and unassigned rem0g Dec 12, 2024
@susanodd
Copy link
Collaborator

susanodd commented Dec 12, 2024

This is solved in this pull request #1419

This has to do with the code needing to obtain the Gloss ID from the filename when the user is anonymous.

This is in order to check permissions.

The code that does this is in the protected_media url handler.

@susanodd
Copy link
Collaborator

@rem0g is this a high priority? It concerns a (public) link to a kind of video file.

I fixed this in the Public View pull request.

If this is a high priority, I need to split the code for protected_media into a separate branch, to speed up the review.

susanodd added a commit that referenced this issue Dec 14, 2024
…ts own branch.

Since links to the new video types are already being used publically.
@susanodd
Copy link
Collaborator

@rem0g this should be working for you now,.

It will also work when the new perspective NME videos are available. @Woseseltops is working on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants