Skip to content

FIX: Improve file upload error handling and validation #20

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ademolaomosanya
Copy link
Contributor

This PR addresses issue #17 by implementing a proper error handling for file upload in the MwJson extension.

  1. A pre-upload validation is added in MwJson_editor.js. (File type (MIME type) validation when a schema declares a specific allowed types and File size validation if the max size limits is set.
  2. Improve the error detection in MwJson_api.js by adding proper null checks '(data && data.upload && data.upload.result === "Success")' and adding Specific error messages for different types of upload failures. So we can now catch all error scenarios, even with unexpected API response formats.

These are my propose changes that i have made so far, i havent tested the changes properly due to environment limitations.
Looking foward to your review and feedback @simontaurus

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

Successfully merging this pull request may close these issues.

1 participant