Skip to content

Conversation

samuelallan72
Copy link
Contributor

@samuelallan72 samuelallan72 commented Jul 28, 2025

Description

If a file is deleted from disk somehow after the student response has been submitted, the api will still respond with metadata about these files. However, the download url will be empty, resulting in broken files in the frontend ui: the preview pane will display an "Unknown error", and downloading the files will result in downloaded files with the correct file names but invalid content.

The student view in ORA handles these deleted files by simply ignoring them and not displaying them to the user. So here we do the same: simply filter out any deleted files from the api.


Screenshots of the UI before:

1753690484

and after:

1753690602

Supporting information

none

Testing instructions

  1. Deploy this frontend app and create a test open edx course containing an ora block with a file upload field.
  2. Navigate to the ora block, upload two previewable files (eg. pdf or image files), click submit, and then click confirm.
  3. Then as fast as you can, click 'delete' next to one of the uploaded files in the UI (while the submission is still processing), and hit enter to accept the confirmation popup. This exploits a race condition in the UI - I think users on slow internet connections may run into this more often.
  4. Refresh the page and view your submission in the same student view of the ora block.
  5. Verify that only one uploaded file is displayed (not the file that was deleted).
  6. Navigate to the ora grading view for this ora block.
  7. View the submission for your user.

Without this patch:

  • Verify that you see both files in the submission.
  • Verify that the file preview for the file you deleted shows an "Unknown errors" error message (while the other one should succeed).
  • Download the submission files as a zip, unzip it, and verify that the file contents is invalid (it will be html, from the ora-grading app).

With this patch:

  • Verify that you see only one uploaded file, and that is successfully displayed in the preview pane.
  • Download the files as a zip from the UI, unzip them, and verify that the manifest only shows the one file, and that the file included is valid and the file you uploaded (not the one you deleted).
  • Verify that there are no related errors.

Deadline

None

Other information

This is a minor frontend change only, so it shouldn't affect backwards compatibility.
The behaviour change is also in line with how the ORA block works already for the existing views.

Private-ref: https://tasks.opencraft.com/browse/BB-9781

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 28, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 28, 2025

Thanks for the pull request, @samuelallan72!

This repository is currently maintained by @codewithemad.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

If a file is deleted from disk somehow
after the student response has been submitted,
the api will still respond with metadata about these files.
However, the download url will be empty,
resulting in broken files in the frontend ui:
the preview pane will display an "Unknown error",
and downloading the files will result in downloaded files
with the correct file names but invalid content.

The student view in ORA handles these deleted files
by simply ignoring them and not displaying them to the user.
So here we do the same:
simply filter out any deleted files from the api.

Private-ref: https://tasks.opencraft.com/browse/BB-9781
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Jul 29, 2025
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 29, 2025
@mphilbrick211
Copy link

Hi @samuelallan72 - thank you for this contribution! Please let me know if you have any questions regarding submitting a CLA form. Thanks!

@e0d
Copy link
Contributor

e0d commented Aug 4, 2025

@samuelallan72 Your branch is behind the base. I've pulled in changes from master as a merge commit which will update your branch and cause the tests to be re-run.

@e0d
Copy link
Contributor

e0d commented Aug 4, 2025

@samuelallan72 I notice there are some failed checks on this PR, can you have a look?

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Aug 4, 2025
@e0d e0d moved this from Needs Tests Run or CLA Signed to Waiting on Author in Contributions Aug 4, 2025
@samuelallan72
Copy link
Contributor Author

Thanks @e0d , I'm holding off on this PR for now (leaving it in draft). I'm working on #2319 to try to avoid the issue happening at the source. I'm not sure if this fix will still be required after the other is implemented. :)

@samuelallan72 samuelallan72 self-assigned this Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

4 participants