tasvideos icon indicating copy to clipboard operation
tasvideos copied to clipboard

IsValidImage() not checked when trying to publish with video instead of screenshot

Open vadosnaprimer opened this issue 4 months ago • 1 comments

That check is meant to prevent this mistake from happening (I had video and screenshot in the same folder this time so I accidentally picked the video). But instead of telling the user about this error and letting them fix it, you get

Image

which seems to get triggered before

https://github.com/TASVideos/tasvideos/blob/be53b09f47a5340f1e9ddc2fbc6bdabe26b9b36f/TASVideos/Pages/Submissions/Publish.cshtml.cs#L60-L63

is even called. Resulting in that error page that is now opened, and all the data you've entered for the publication getting lost. In my case I manually wrote the description, so having to remember and recreate it felt like a sign that this should be prevented by the code. And it almost is but not quite.

PS: I guess if my video was 20MB or less, the check would have been triggered. Dunno if it's possible to reject it without bringing you to the error page even if it's above that size.

vadosnaprimer avatar Jul 18 '25 14:07 vadosnaprimer

You can't use any C# code to do this check. Our nginx has to create a hard error, otherwise the file would reach our server and use up bandwidth and processing and all that stuff we're trying to prevent in the first place.

The only approach I can see here is to write custom JavaScript that prevents users from selecting files that are too large. I'm not sure if that's possible though.

Masterjun3 avatar Jul 18 '25 15:07 Masterjun3