Re:Sublime Text 4 [video]
by whalesalad on Wednesday March 31, 2021 @12:31PM
(#26649317)
Hah, thanks for the review! Great feedback. This was a coding challenge from a few years ago when I applied for a gig at Zapier. It was time capped so I didn't spend any extra time making it perfect.
Note that in the screenshot there are yellow boxes around the `raise` keyword - this is a complaint from the linter to do exactly as you suggest.
Re:Sublime Text 4 [video]
by stickyricky on Wednesday March 31, 2021 @11:37AM
(#26648620)
raise FileTooBig(str(e)) from e
I did not know this was possible. Thanks!
First, in service.api.api:43-49 you do:
My understanding is you're receiving some file then storing it somewhere with the name provided by the client. That to me looks like a potential security issue. It looks like this function (what is this, Flask?) is both a view and a validator, yet it looks like the file name is not sanitised in any way. I would not accept all characters here. There are two problems: first is the name you use to save the file on disk. Think about e.g. slashes, dots, spaces and the non-printable characters. The other one is about access: if e.g. the file name contains "#" or other special URL character, the file might not be accessible at all.Second, in service.api.api:54-55 you have:
This masks the original exception. In order to avoid that, you have to tell the engine the new exception you're raising is the direct cause of some other exception: It might not be that important with a client error like this, though. At worst it helps with debugging. [/off topic]