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

[Fix #49104] Add server response (xhr) to direct-upload:error event. #49956

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Nov 7, 2023

  1. [Fix rails#49104] Add server response (xhr) to direct-upload:error ev…

    …ent.
    
    ActiveStorage's javascript does not provide access to the server response for error messaging when an error occurs during a direct upload.
    
    This is a problem because we cannot distinguish between an upload failing due to authorization or the file being too large or any other validation error.
    
    This change updates the error event to include the `xhr` object so that the server response is accessible to error handling code. This allows us to display the specific issues that caused the upload to be rejected such as:
    - You must be an admin to upload this file.
    - File must be less than 100MB.
    - Uploading .exe files is not permitted.
    seanabrahams committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    744be77 View commit details
    Browse the repository at this point in the history
  2. Resolve lint errors.

    seanabrahams committed Nov 7, 2023
    Configuration menu
    Copy the full SHA
    4937ad3 View commit details
    Browse the repository at this point in the history