revolution icon indicating copy to clipboard operation
revolution copied to clipboard

Can't make .htaccess editable from manager in 3.0

Open Mark-H opened this issue 2 years ago • 3 comments

Bug report

Summary

In 2.x, adding htaccess to the upload_files system setting would allow you to edit .htaccess files from the manager. That doesn't seem to work in 3.0.1 anymore.

Step to reproduce

Add htaccess to the upload_files system setting.

Observed behavior

Error File extension `` is not permitted.

Expected behavior

Allow editing .htaccess files when opted in.

Environment

Probably all.

Mark-H avatar Jul 11 '22 15:07 Mark-H

The problem seems to be this line in the sanitize function that removes the dot from the file name. https://github.com/modxcms/revolution/blob/26866e13963084610bb03c89b635654813f55a86/core/src/Revolution/Processors/Browser/Browser.php#L146

halftrainedharry avatar Jul 12 '22 09:07 halftrainedharry

Maybe that can be restricted to two starting dots: #^(\.{2}|/)+#u

Should be safe: https://regex101.com/r/FbuRLQ/1

The dot files have to be restricted elsewhere.

Jako avatar Jul 12 '22 11:07 Jako

Maybe that can be restricted to two starting dots: #^(\.{2}|/)+#u

Should be safe: https://regex101.com/r/FbuRLQ/1

The dot files have to be restricted elsewhere.

That's also how it's done in 2.x: https://github.com/modxcms/revolution/commit/74044ab4fcadb4ad65b9cc5e485e1a2ee737b2c4

JoshuaLuckers avatar Jul 29 '22 13:07 JoshuaLuckers