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

Feature/check svg file type #2078

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Conversation

szabozoltan69
Copy link
Contributor

@szabozoltan69 szabozoltan69 commented Mar 20, 2024

Validating file uploads.
Also fixes #2077 (which issue was a blocker of proper testing).

@szabozoltan69 szabozoltan69 requested review from thenav56 and k9845 March 20, 2024 14:57
@szabozoltan69 szabozoltan69 force-pushed the feature/check-svg-file-type branch 5 times, most recently from 9c2496b to 8e65199 Compare March 21, 2024 13:47
Copy link
Member

@thenav56 thenav56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@szabozoltan69 Look good.

I noticed the validation using file_field in validated_data. It is much easier to have a function validate_<file_field> instead, as it will handles both create and update, and we don't have to check if the field is provided by the client for different API methods.

per/serializers.py Outdated Show resolved Hide resolved
per/serializers.py Outdated Show resolved Hide resolved
per/serializers.py Outdated Show resolved Hide resolved
flash_update/serializers.py Outdated Show resolved Hide resolved
dref/serializers.py Outdated Show resolved Hide resolved
databank/serializers.py Outdated Show resolved Hide resolved
api/models.py Outdated Show resolved Hide resolved
api/models.py Outdated Show resolved Hide resolved
api/models.py Outdated Show resolved Hide resolved
utils/file_check.py Outdated Show resolved Hide resolved
@szabozoltan69 szabozoltan69 force-pushed the feature/check-svg-file-type branch from 8e65199 to b445069 Compare March 26, 2024 13:47
@szabozoltan69 szabozoltan69 requested a review from thenav56 March 26, 2024 13:47
@szabozoltan69
Copy link
Contributor Author

@thenav56 I implemented the suggested changes. Really nicer this way! :-)

@szabozoltan69
Copy link
Contributor Author

(Also tested it locally.)

@szabozoltan69 szabozoltan69 merged commit 1deaa5f into develop Mar 26, 2024
1 check passed
@szabozoltan69 szabozoltan69 deleted the feature/check-svg-file-type branch March 26, 2024 14:00
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.

[PROD] Image upload difficulty on Admin pages
2 participants