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

Feature request: add upload file path to log data #152

Open
bh-teufels opened this issue May 4, 2022 · 4 comments
Open

Feature request: add upload file path to log data #152

bh-teufels opened this issue May 4, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@bh-teufels
Copy link

the uploaded files get logged with file name, it would be awesome when also the path get logged.

on upload the files get saved in the selected storage inside a generated folder like "form_7c4bf264b5c1236827517ad756d0c71988d24296"

so it would be helpfull if i could get the storage path from the formlog entry

thanks

@mbrodala mbrodala added the enhancement New feature or request label May 4, 2022
@mbrodala
Copy link
Member

mbrodala commented May 4, 2022

Good idea, can you post a PR? Adding this and adjusting the tests should be rather easy.

@bh-teufels
Copy link
Author

it is indeed really simple just add

'path' => $formValue->getIdentifier(), to LoggerFinisher.php -> getFormValues() at line 79

[...]
if ($formValue instanceof CoreFileReference) {
                    debug($formValue);
                    $normalizedFormValues[$identifier] = [
                        'file' => [
                            'name' => $formValue->getName(),
                            'path' => $formValue->getIdentifier(),
                        ],
                    ];
                    continue;
                }
[...]

@bh-teufels
Copy link
Author

i also would add
'url' => $formValue->getPublicUrl(),
which links to the file so it is possible to directly view and download the file

@mbrodala
Copy link
Member

mbrodala commented May 4, 2022

Notice that the file identifier doesn't need to be its path. While this is the case for the local driver, this may be different for other storages using e.g. remote drivers. Instead one would need to use $fileReference->getForLocalProcessing(false), but this may lead to a local copy of remote files in case of remote storages.

But $fileReference->getPublicUrl() should be safe to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants