Menu

Error when uploading documents with file name containing Greek letters

Themoulos
2017-02-22
2017-02-22
  • Themoulos

    Themoulos - 2017-02-22

    Hi from Greece,

    I installed SeedDMS version 5.0.9. It runs fine, with one minor glitch.

    When I try to automatically upload one or more documents with names starting
    with Greek letters, the file name gets truncated to the first not-Greek
    letter.

    Example:

    "ΑΒΓ_01_2017.doc" is saved as "_01_2017.doc." ->truncated 3 characters

    "Δ_01_2017_ΠΦΣ.doc" is saved as "_01_2017_ΠΦΣ.doc"->truncated 1 character

    BUT

    "01_ΑΒΓ_2017.doc" is saved as "01_ΑΒΓ_2017.doc" ->correct

    I am not sure if the Greek characters show correctly in my mail, if not, I
    will send you a .png to show the error.

    Only the starting letters are omitted. Greek letters after the first one
    show fine, regardless of position and number.

    Please help,

    Manolis Papadopoulos

     
  • ank-99

    ank-99 - 2017-03-02

    I verify this behavior exactly as described above. My version is 5.0.6.

     
  • Themoulos

    Themoulos - 2017-03-02

    Dear Uwe,
    can you direct me where in the code the name is created?
    I am willing (determined actually), to do any necessary debugging myself, if the answer is not simple.
    I will start from there and see what I can do. As stated above, my version is 5.0.9.

     

    Last edit: Themoulos 2017-03-02
  • Uwe Steinmann

    Uwe Steinmann - 2017-03-03

    The problem is caused by a misbehaviour of php's function basename(). Version 4.3.24, 5.0.11 will have a fix for it.

     
  • Themoulos

    Themoulos - 2017-03-04

    basename() is used in more than 100 places, in 79 php files. Which is the file and line that do not work well? I will try to fix it as soon as possible, it is critical for me, because the site is already up and I can upload only English named files...
    As far as I can tell, it must be in line 585 of op.Ajax.php. Am I correct?

     

    Last edit: Themoulos 2017-03-04
  • Uwe Steinmann

    Uwe Steinmann - 2017-03-06

    It is used at many places, but in many cases it doesn't do any harm. There is only a problem, if the first char of a filename is a non ascii char. This can only happen for those files uploaded by the user.

    line 585 and 684 in op.Ajax.php need to be fixed. Also, all occurences of basename() in op.AddDocument.php are affected.

     
  • Themoulos

    Themoulos - 2017-03-06

    Thanks you for your very helpful answer.
    I fixed the problem by adding:

    setlocale(LC_CTYPE,"el_GR.UTF8");

    after the initial "include ..." lines in the two php files:

    line 34 in op.Ajax.php and
    line 31 in op.AddDocument.php.
    No other change in basename() is needed (as far as I have tested! I will upload as many files as possible tonight and I will let you know, first thing tomorrow morning).

    I know this is a quick and dirty job, but it is enough for me right now, that my bottom is on fire. I suppose we could add a setting like that of the supported languages, where the user can choose the supported languages for the file names. Or use the current as the selection for the file names as well.

    Wiedermals Vielen Dank!

     
  • Themoulos

    Themoulos - 2017-03-07

    After many - many uploads, the files are uploaded OK, without error. The only point that is still erroneous is when adding an attachment. Exactly the same phenomenon. See attached screen capture. Ay suggestion will be upreciated!

     
  • Uwe Steinmann

    Uwe Steinmann - 2017-03-08

    If you put the setlocale() in op/op.Ajax.php and op/op.AddDocument.php, then also put it in op/op.AddFile.php. That file takes care of uploading attachments.

     

Log in to post a comment.

MongoDB Logo MongoDB