1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-09-20 13:34:04 +00:00

Trim any trailing separator from the original root in diskRoot

Since $originalRoot can be an OS path (with local disks without root_override) or a remote path/key (e.g. with S3 or FTP), we can't assume either separator while trimming. Trimming only '/' missed a trailing '\' on a Windows local root, so e.g. 'C:\app\uploads\' became 'C:\app\uploads\/tenant1'.

(The appended '/' stays as is -- it's accepted on Windows and it's the only correct separator for remote disks.)

Note that in practice, this wasn't an issue that could break anything. But assuming '/' in the rtrim code was incorrect.
This commit is contained in:
lukinovec 2026-08-26 17:11:59 +02:00
parent bd101797ea
commit 857c6fc233

View file

@ -164,7 +164,7 @@ class FilesystemTenancyBootstrapper implements TenancyBootstrapper
// This is executed if the disk is in tenancy.filesystem.disks but does NOT have a root_override // This is executed if the disk is in tenancy.filesystem.disks but does NOT have a root_override
// This behavior is used for disks like S3. // This behavior is used for disks like S3.
$newRoot = $originalRoot $newRoot = $originalRoot
? rtrim($originalRoot, '/') . '/' . $suffix ? rtrim($originalRoot, '/\\') . '/' . $suffix
: $suffix; : $suffix;
} }