_filefield_source_attach_directory() calls file_default_scheme() with an argument of $field['settings']['uri_scheme']; however, file_default_scheme does not accept any argument.

Should file field sources still support setting attach directory in field setting scheme... ?
The attach source copies the file to the #upload_location of the actual item, so the attach source directory should not have to be the same as the final scheme.

Comments

recrit’s picture

Status: Active » Needs review
StatusFileSize
new470 bytes

The attached patch removes the argument from file_default_scheme().

quicksketch’s picture

Seems like the scheme should be used no matter what and we should just drop the use of file_default_scheme() and keep the scheme variable.

recrit’s picture

@quicksketch: that could be better b/c if you're using some other protected directory, you'd specify with absolute path. So this case is really for the option of "within the files directory" and for the case of private, you'd definitely want to be uploading to private. It just seems in that case you would use the absolute path and then on the copy the new file gets private scheme.

quicksketch’s picture

Title: Attach directory default scheme » Remove unneeded parameter from file_default_scheme()
Category: support » task
Status: Needs review » Fixed

For now I've committed #1. No API change or updates needed in this situation.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j.somers’s picture

Status: Closed (fixed) » Needs work

I'm opening this issue again because I'm bumping into this.

I want my file_attach location to be within the private directory. Together with the patch from #1492374: Attach source reference existing file where it's the same as source I want to bypass the PHP and MySQL timeout that gets triggered on shared hosting solutions when working with very large files. (500MB and up)

This of course works for files in the public directory, but doesn't for files within the private directory because the file attach source location will always be relative to the public files folder.

I'm curious about why the $field['settings']['uri_scheme'] option was not used instead of the call to file_default_scheme(). Shouldn't it simply be better?

On a side-note: the call to $field = field_info_field($instance['field_name']); is still present, but the $field variable is not used, so that should have been removed too. :-)

quicksketch’s picture

Happy to review patches. ;)

  • c4b6ca1 committed on 8.x-1.x
    Issue #1228800 by recrit: Remove unneeded parameter from...