Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2022-05-31 19:09:36

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,960
Website Mastodon

Re: uploading images with special characters not working?

jakob wrote #333476:

You are absolutely right: the file name in the browser bar changes when you choose save. Here you can see them both together in one screenshot:

!https://imgur.com/bKMr4RQ! – https://imgur.com/bKMr4RQ

Presumably that character is the cause of the problem.

so the mystery is … how does that happen? is it to do with our browsers? our OS system?


…. texted postive

Offline

#14 2022-05-31 19:16:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,795
Website GitHub

Re: uploading images with special characters not working?

We sanitize/dumb down filenames to prevent any encoding issues with non-standard characters. Perhaps we’re sanitizing using different rules in different places instead of unifying them?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#15 2022-05-31 22:09:05

etc
Developer
Registered: 2010-11-11
Posts: 4,708
Website GitHub

Re: uploading images with special characters not working?

bici wrote #333475:

how is D_Italia changed to D'Italia ?? and this is the file that TxP fails to upload although SFTP has no issues.
mystery.

The explanation probably comes from this response header:

content-disposition: inline; filename="Giro_D'Italia_Poster_1920x1080.jpeg"

Offline

#16 2022-06-01 00:33:07

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,763
Website

Re: uploading images with special characters not working?

etc wrote #333471:

Because I have copied it from the textiled output.

Ok then, maybe my bad for going on the wrong track

Ok, from few tests it looks like

  • uploading works fine
  • numeric txp image URLs are fine too
  • textile borkes

But txp itself does not store images under their original names, replacing them with a number. So this looks like a pure Textile problem.

Uploading works fine on localhost here. But on two different live hosts (Linux/Apache + UbuntuOS / PHP 8 on one, CentOS / PHP 8.1 on the other one) this fails silently, in both cases with the same 500 Internal Server Error message in the console. URL encoding the one troublesome character works fine though.

Of course once you manage to upload the image, from the Textpattern side everything is OK – it uses the ID as a reference everywhere.

The upload issue might be some mod_security setting.

PS – in raw HTML (<img />, etc) it can be a proble, depending on the style of quotes around attributes.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#17 2022-06-01 04:32:16

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,960
Website Mastodon

Re: uploading images with special characters not working?

thanks all for your input and help with this issue. It might be best going forth to remove all funny characters from file names.


…. texted postive

Offline

#18 2022-06-01 06:04:53

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,763
Website

Re: uploading images with special characters not working?

bici wrote #333487:

It might be best going forth to remove all funny characters from file names.

Yeah… particularly such “special” characters as the humble ' that can cause havoc for various reasons.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#19 2022-06-01 08:21:51

etc
Developer
Registered: 2010-11-11
Posts: 4,708
Website GitHub

Re: uploading images with special characters not working?

phiw13 wrote #333484:

Uploading works fine on localhost here. But on two different live hosts (Linux/Apache + UbuntuOS / PHP 8 on one, CentOS / PHP 8.1 on the other one) this fails silently, in both cases with the same 500 Internal Server Error message in the console. URL encoding the one troublesome character works fine though.

Good to know, thanks. AFAIK, there was no change in image names filtering since a while, dunno why this problem rises only now. Could be tricky to fix, since this seems to happen outside txp.

Offline

#20 2022-06-01 11:53:18

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,763
Website

Re: uploading images with special characters not working?

etc wrote #333492:

Good to know, thanks. AFAIK, there was no change in image names filtering since a while, dunno why this problem rises only now.

’cause no one tried to upload a file with a ' in the filename before ? :-)

Could be tricky to fix, since this seems to happen outside txp.

Is there anything to fix? I think the rejection by the server happens too fast anyway, if it is what I think it is. I’ll try to remember to ask the server people what the reason might be.


Where is that emoji for a solar powered submarine when you need it ?

Offline

#21 2022-06-01 15:43:08

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,960
Website Mastodon

Re: uploading images with special characters not working?

So in the interest of scientific enquiry today I decided to upload that pesky file using my Expression Engine website’s file upload module. … which produced an explosion and caused this error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache Server at ponzanoveneto.com Port 80

of course i tried a simple file name next —- image.png — and no issues. Could this be an Apache server glitch? who knew a little old ' could be so dangerous!!


…. texted postive

Offline

#22 2022-06-01 19:43:24

etc
Developer
Registered: 2010-11-11
Posts: 4,708
Website GitHub

Re: uploading images with special characters not working?

phiw13 wrote #333494:

Is there anything to fix? I think the rejection by the server happens too fast anyway, if it is what I think it is. I’ll try to remember to ask the server people what the reason might be.

We could try to sanitize filenames via Javascript on submit, but I have no idea whether it would work.

Offline

#23 2022-06-03 00:06:25

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 2,763
Website

Re: uploading images with special characters not working?

Support thread on the Opalstack forums.

Core of the error log:

ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_STRICT_ERROR" required. [file "/etc/httpd/conf.modules.d/security.conf"][line "26"] [id "200002"] [msg "Multipart request body failed strict validation:       PE 0,       BQ 0,       BW 0,       DB 0,       DA 0,       HF 0,       LF 0,       SM 0,       IQ 1,       IP 0,       IH 0,       FL 0"]

Where is that emoji for a solar powered submarine when you need it ?

Offline

#24 2022-06-03 00:19:20

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 1,960
Website Mastodon

Re: uploading images with special characters not working?

phiw13 wrote #333514:

Support thread on the Opalstack forums.

Core of the error log:

ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_STRICT_ERROR" required. [file "/etc/httpd/conf.modules.d/security.conf"][line "26"] [id "200002"] [msg "Multipart request body failed strict validation: PE 0, BQ 0, BW 0, DB 0, DA 0, HF 0, LF 0, SM 0, IQ 1, IP 0, IH 0, FL 0"]...

Great idea posting on those support forums. Thanks


…. texted postive

Offline

Board footer

Powered by FluxBB