- First commit to issue fork.
- 🇮🇳India rajeshreeputra Pune
We can use the
realpath()
method of FileSystem.I have validated the MR changes with shield module and it work as expected. Hence requesting review.
- 🇺🇸United States cmlara
We can use the realpath() method of FileSystem.
Given the following documentation of the API Method can you provide more justification?
* The use of this method is discouraged, because it does not work for * remote URIs. Except in rare cases, URIs should not be manually resolved. * * Only use this function if you know that the stream wrapper in the URI uses * the local file system, and you need to pass an absolute path to a function * that is incompatible with stream URIs. *
— FileSystemInterface::realpath()
Does the key module know that a path is a local filesystem? Is this a rare case? If so why? Does the module need to pass an absolute path to a function? If so which function only accepts absolute paths?
- 🇮🇳India rajeshreeputra Pune
Hello @cmlara,
I am currently experiencing an issue when provided file path located on a different server or outside the Drupal project scope, as it is returning an following error. Hence I mentioned that we can use the
realpath()
method of FileSystem.Could you please let me know if there's anything I'm missing that would enable me to provide a file path located on a different server or outside the Drupal project scope?
- 🇺🇸United States cmlara
Could you please let me know if there's anything I'm missing that would enable me to provide a file path located on a different server or outside the Drupal project scope?
Using the S3fs module with the file at s3://test.txt would be an example that works key when this patch is not applied. Once this patch enforces realpath I would expect the following to no longer function.
> file_put_contents('s3://test.txt', 'testkey'); = 7 > file_get_contents('s3://test.txt'); = "testkey" > Drupal::service('key.repository')->getKey('s3key')->getKeyValue() = "testkey"
- 🇮🇳India rajeshreeputra Pune
Hello @cmlara, updated to work with realpath, stream wrapper and remote urls. Could you please validate with s3 once. Will keep this in needs work status.