flysystem icon indicating copy to clipboard operation
flysystem copied to clipboard

Issue with backslashes under Linux environment

Open Atnaize opened this issue 1 year ago • 1 comments

Bug Report

Q A
Flysystem Version 3.11.0
Adapter Name local
Adapter version NA

Summary

Hi,

I've encountered an issue related to backslashes when using the library under a Linux environment. When I execute $disk->allFiles(), I receive the following result:

[
    0 => "DICOM/1.3.12.2.1107.5.1.4.66516.30000023081604420836300000406.dcm",
    1 => "DICOM/1.3.12.2.1107.5.1.4.66516.30000023081604420836300000544.dcm",
 ]

At first glance, this output appears to be correct. However, when I run the ls -lsa command directly on the same folder on the server, I observe the following: image

As you can see, the library is transforming backslashes (\) into forward slashes (/). This transformation leads us to assume that all files are located within the "DICOM" directory.

In a Linux system, where backslashes are not used as path separators, the system interprets DICOM\1.3.12.2.1107.5.1.4.66516.30000023081604420836300000406.dcm as a file rather than as a file within the "DICOM" directory.

This issue becomes problematic further in the process when I attempt to use $disk->delete($file);. I encounter the following error message:

Unable to retrieve the file_size for file at location: DICOM/1.3.12.2.1107.5.1.4.66516.30000023081604420836300000406.dcm. as this file does not exists.

This error occurs because the file is not found, likely due to the incorrect path format.

Expected Behavior:

The library should not transform backslashes into forward slashes under a Linux environment, ensuring that file paths are correctly interpreted.

Atnaize avatar Sep 06 '23 08:09 Atnaize

Please add a script to re-create this with Flysystem. This is not a Laravel support channel. Unless provided, this issue will be closed.

frankdejonge avatar Jan 23 '24 12:01 frankdejonge