Skip to content

Edge case for scoped filesystem driver for a tenant bootstrapped disk #1401

@viicslen

Description

@viicslen

Bug description

When using scoped disks/driver from a disk that has been defined in the tenancy.filesystem.disks config. The resolved instances of those disks are not forgotten when initializing or reverting the FilesystemTenantBootstrapper and therefore persisting the previous tenant path prefix withing the application lifecycle.

Steps to reproduce

  1. Define a tenant disk in config/tenancy.php
return [
    // ...
    'filesystem' => [
        'disks' => ['local'],
    ],
    // ...
];
  1. Define a scoped disk in config/filesystem.php
return [
    // ...
    'disks' => [
        'tenant-public' => [
            'driver' => 'scoped',
            'disk' => 'local',
            'prefix' => 'app/public',
            'visibility' => 'public',
        ],
    ],
    // ...
];
  1. Create two tenants
  2. Initialize one tenant and request the path using the Storage facade
  3. Initialize the second tenant and request the path using the Storage facade

Expected behavior

Disks scoped to a tenant bootstrapped disk should also be forgotten on tenant initialization

Laravel version

11.46.0

stancl/tenancy version

3.9.1

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions