- πͺπΈSpain budalokko Girona
Could you provide some further instructions to reproduce the error? Maybe there's another module involved.
Did some tests with both PlUpload and also Plupload Widget on a minimal install but could not reproduce.
Thank you !!
- Issue was unassigned.
- Status changed to Needs work
almost 2 years ago 8:14pm 5 July 2023 - πΊπΈUnited States jcandan
Got it. Took some digging, but I found the specific line that is causing a 500 on the temporary file check.
/** * @file src/UploadController.php */ ... protected function getFilename() { ... if (!preg_match('/^\w+\.tmp$/', $this->filename)) { throw new UploadException(UploadException::FILENAME_ERROR); } ..
Filenames with dashes or spaces are not being matched by the
\w+
.I've created a PHP Live Regex permalink for easy testing.
I am getting this while using the Photos module with its Plupload setting enabled.
Personally, I think we should go with the option to adjust the regex rather than hack the temporary filename.
I tried
^[-\s\w]+\.tmp$
in the PHP Live Regex, and it seems like a good fit.Any other characters we should account for? Is there some official filename protocol we should shoot for?
- Status changed to Postponed: needs info
over 1 year ago 6:12pm 20 July 2023 - πͺπΈSpain budalokko Girona
Sry did some attempts with the Photos module too, but still can't reproduce.
In all situations
$this->filename
at theUploadController::getFilename()
method pointed by @jcandan has normal temporary file names in the formo_1h5q7bd49ffi1ps1b10puroh2b.tmp
which passes the validation.What has to be done so the original file name with spaces or whatever characters reaches this point of the code?
Maybe in your situations there is some Ajax involved? Which version of the plupload library are you using?
Setting as "maintainer needs more info" because would like to see the issue before loosening that preg_match.
Thanks !!
- π¨π³China lawxen
I got the same error,. when using https://www.drupal.org/project/feeds_plupload β , If the file name is chinese, like ζ΅·θηθ±ε2ε·.jpg, error coming
- πͺπΈSpain budalokko Girona
As mentioned in #5, at that point of the code `$this->filename` should not contain the original file name but an internal filename in a very specific form: `o_1h5q7bd49ffi1ps1b10puroh2b.tmp`.
To fix this issue we need to find why in your setups `$this->request->request->get('name')` contains the original file name instead.
Plupload library seems to already send this file name in the request payload. Can you compare the following screenshots with your situation? Maybe then we can discover why the original file name happens to be there.
This was with:
- Drupal 9.5.
- Plupload 2.1.x at /plupload-test (provided by plupload_test submodule).
- Plupload library v2.1.9 or v2.3.9 or v3.1.5