On Friday, June 19, 2020 at 4:30:12 AM UTC-7, Константин Комков wrote:
>
> I am very happy today! I can find user who can't load file and talk with 
> him. User can't load file with name:
> ФГБОУ ВО Липецкий государственный педагогический университет им. П.П. 
> Семенова-Тян-Шанского
>
> filename in error for that file is 
>
> doc_images.file.9bbb3bdd72dc6f61.d0a4d093d091d09ed0a320d092d09e20d09bd0b8d0bfd0b5d186d0bad0b8d0b920d0b3d0bed181d183d0b4d0b0d180d181d182d0b2d0b5d0bdd0bdd18bd0b920d0bfd0b5d0b4d0b0d0b3d0bed0b3d0b8d187d0b5d181d0bad0b8d0b920d183d0bdd0b8d0b2d0b5d180d181d0b8d182d0b5d18220d0b8d0bc2e20d09f2ed09f2e20d0a1d0b5d0bcd0b5d0bdd0bed0b2d0b02dd0a2d18fd0bd2dd0a8d0b0d0bdd181d0bad0bed0b3d0be2e6a7067.jpg
>
> How can I validate it? As I understand I need to set maximal length for 
> filename, yes?
>


In the book,
<URL:http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-types>
it says there is no default validator for upload fields, and there is a 
remark that "default length is 512 bytes" , but the name-encoding process 
is likely to cross the 512 byte boundary somewhere around 200-240 original 
characters (depending on how many multi-byte characters there are).  In 
addition to the DB limits, the OS is likely to have a maximum size of file 
name (I don't remember what it is for NTFS, but it is likely smaller than 
the maximum permissable path; a quick goo-search indicates both are 260 
unless you have W10 *and* you have changed a registry setting)..  If the 
filesystem isn't allowing the encoded name because of length, I'd have 
expected the ticket to occur before the not-found error, but I haven't 
checked out how that try-except is set up.

I haven't tried setting a validator, but you've already done that.  
IS_UPLOAD_FILENAME() seems not to have a filename length check.  You could 
try making your regex not fit names that exceed a limit, or you could do a 
ON_VALIDATE hook to check the length directly.

/dps



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/1feabe7b-aac8-44c8-9186-98ebf7d63ac7o%40googlegroups.com.

Reply via email to