learningequality / learningequality/studio

Do better validation on file payloads

Open
#5,022 0 comments 0 reactions 1 assignee View on GitHub

@rtibbles is already working on this.

Since Apr 25, 2025.

Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

IntegrityError: new row for relation "contentcuration_file" violates check constraint "file_media_duration_int"

Sentry Issue: STUDIO-HRQ

CheckViolation: new row for relation "contentcuration_file" violates check constraint "file_media_duration_int"
DETAIL:  Failing row contains (db898e1b5381437fbc8f7d242d606983, 0b57166c9f549fbf4cadd6828d36ecb4, 1574207, storage/0/b/0b57166c9f549fbf4cadd6828d36ecb4.mp3, TLL_Leson 7.2_Mwayen-transpò_Odyo.mp3, 3e164cbf3dac4734898567d7d45dca64, mp3, null, document_thumbnail, null, null, 19, null, 2025-04-24 19:40:57.777972+00, 393).

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django_prometheus/db/common.py", line 69, in execute
    return super().execute(*args, **kwargs)

IntegrityError: new row for relation "contentcuration_file" violates check constraint "file_media_duration_int"
DETAIL:  Failing row contains (db898e1b5381437fbc8f7d242d606983, 0b57166c9f549fbf4cadd6828d36ecb4, 1574207, storage/0/b/0b57166c9f549fbf4cadd6828d36ecb4.mp3, TLL_Leson 7.2_Mwayen-transpò_Odyo.mp3, 3e164cbf3dac4734898567d7d45dca64, mp3, null, document_thumbnail, null, null, 19, null, 2025-04-24 19:40:57.777972+00, 393).

(13 additional frame(s) were not displayed)
...
  File "contentcuration/views/internal.py", line 299, in api_add_nodes_to_tree
    "root_ids": convert_data_to_nodes(request.user, content_data, parent_id)
  File "contentcuration/views/internal.py", line 665, in convert_data_to_nodes
    map_files_to_node(user, new_node, node_data["files"])
  File "contentcuration/utils/nodes.py", line 92, in map_files_to_node
    resource_obj.save()
  File "contentcuration/models.py", line 2393, in save
    super(File, self).save(*args, **kwargs)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.