- πΊπΈUnited States smustgrave
If still a valid request please reopen.
Thanks!
In file.inc, file_download() invokes all hook_file_download hooks to determine if a file is allowed to be transfered and set transfer headers. But there is no hook invoked if the transfer is allowed to proceed. For example, let's say I want to be able to keep file download statistics, but only if a transfer is allowed. If I implement a hook_file_download, I don't know if hooks invoked before or after my module will deny the transfer, and my statistics will be off.
I suggest introducing a new hook (e.g. hook_file_transferring or something more appropriate) which is invoked on all modules in file_download() just before the call to file_transfer():
if (file_exists(file_create_path($filepath))) {
$headers = module_invoke_all('file_download', $filepath);
if (in_array(-1, $headers)) {
return drupal_access_denied();
}
if (count($headers)) {
module_invoke_all('file_transferring', $filepath, $headers); // This is the new invocation
file_transfer($filepath, $headers);
}
It's up to people smarter than me to determine what return values from hook_file_transferring would be useful and appropriate.
My apologies for wasting your time if this has already been suggested or implemented.
Closed: outdated
9.5
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
If still a valid request please reopen.
Thanks!