Revolution: Invalid relative media source path shows root path contents

Created on 2 Aug 2018  路  10Comments  路  Source: modxcms/revolution

Summary

If you specify an invalid relative path for a Filesystem media source, it displays the contents of the server root folder.

Step to reproduce

Specify basePath as a non-existent relative path with the basePathRelative option set to Yes.

Observed behavior

The media source renders the contents of the root folder of the server.

Expected behavior

It should render nothing since the path is invalid and display some kind of error.

Environment

MODX 2.x (latest), nginx 1.15.0, MariaDB 10.3.7, Chrome, MacOS 10.13.6

bug area-core

Most helpful comment

@mrhaw that's possible by setting basePath to / and basePathRelative to no.

All 10 comments

Ah, I saw this lately on a foreign installation, but I did not realized, that it could be a bug.

I tried to fix this.. but I really can't figure out why it happens..

I think there's a realpath() somewhere that is evaluating to false or null because of the invalid path, resulting in it looking at the root instead.

Yes, this has always bothered me, and my clients get confused (and can potentially do bad stuff) when the contents of the root folder show up.

Question, if we fix this now, how do I go about showing root path for my personal media sources? :)

@mrhaw that's possible by setting basePath to / and basePathRelative to no.

Sweet!! Thanks @JoshuaLuckers

14038 solves that somehow better. But thanks for the PR.

Sorry, I have accidentally closed the issue and not the PR.

Closing this, since #14038 is merged.

Was this page helpful?
0 / 5 - 0 ratings