Skip to content

Need ValidateMedia function #17864

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

Closed
infofromca opened this issue Apr 28, 2025 · 9 comments
Closed

Need ValidateMedia function #17864

infofromca opened this issue Apr 28, 2025 · 9 comments

Comments

@infofromca
Copy link
Contributor

Is your feature request related to a problem?

!allowedExtensions.Contains(extension) is too simple (in Admincontroller of Media

Describe the solution you'd like

Change it to bool ValidateMedia(extention, stream)

Describe alternatives you've considered

@hishamco
Copy link
Member

Where & Why do you need it?

@infofromca
Copy link
Contributor Author

infofromca commented Apr 28, 2025

Where & Why do you need it?

Admincontroller of Media

the virus file can be changed to required extension to be uploaded manually and easily

@hishamco
Copy link
Member

So, how can you validate it?

@infofromca
Copy link
Contributor Author

There are many ways I guess. So in the method I will create a event handlers to leave it to different developers for different purposes

@Piedone
Copy link
Member

Piedone commented Apr 30, 2025

How is this different to #17842?

@infofromca
Copy link
Contributor Author

this happens at !allowedExtensions.Contains(extension) which is before #17842 which happens at eventHandler

@Piedone
Copy link
Member

Piedone commented Apr 30, 2025

That doesn't yet happen anywhere, since it's a proposal; the new event handler can be run anywhere where we see fit.

@infofromca
Copy link
Contributor Author

#17842 original purpose is to sanitize svg which should happen at mediaCreatingEventHandler.MediaCreatingAsync.
but if its purpose is for validation , then decides if go further, yes, it is related with this issue , which will induce "So in the method I will create a event handlers to leave it to different developers for different purposes" -- I plan to give it the name as MediaValidationEventHandler

@Piedone
Copy link
Member

Piedone commented Apr 30, 2025

If we add any sanitization/validation logic, it'll run for all files, not just SVG ones. So, it'll cover this scenario as well. Please add any further details there.

Closing as duplicate.

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

No branches or pull requests

3 participants