Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filesystem::checksum does not call pathNormalizer->normalizePath #1820

Closed
earthiverse opened this issue Oct 7, 2024 · 0 comments
Closed

Comments

@earthiverse
Copy link

Bug Report

I wanted to implement my own PathNormalizer, but I ran into issues when retrieving a checksum.

Q A
Flysystem Version 3.29.0
Adapter Name AwsS3V3Adapter (but any adapter that implements ChecksumProvider will fail, I think)
Adapter version 3.29.0

Summary

I made my own PathNormalizer. It looks like it's correctly working with filesystem->has and filesystem->write, but not filesystem->checksum.

I think

return $this->adapter->checksum($path, $config);
just needs to wrap $path with $this->pathNormalizer->normalizePath($path)?

How to reproduce

<?php

class SillyPathNormalizer implements PathNormalizer
{
    public function normalizePath(string $path): string
    {
        return "silly";
    }
}

$filesystem = new Filesystem(
    adapter: new LocalFilesystemAdapter('data/test'),
    pathNormalizer: new SillyPathNormalizer()
);

$path = 'very';
$filesystem->write($path, 'goose');
$contents = $filesystem->read($path);
assert($contents === 'goose');  // Passes
$checksum = $filesystem->checksum($path); // Throws an exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant