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

Propagate config options to google bucket upload #42

Closed
beesperester opened this issue Nov 24, 2016 · 1 comment
Closed

Propagate config options to google bucket upload #42

beesperester opened this issue Nov 24, 2016 · 1 comment

Comments

@beesperester
Copy link

beesperester commented Nov 24, 2016

Right now you can pass an array containing upload config to writeStream, updateStream etc. after retrieving the filesystem driver via $disk->getDriver() which will essentially pass the arguments to
protected function upload($path, $contents, Config $config)
where the actual config of the google bucket upload happens.

I noticed, that the config arguments are prepared by another function:

protected function getOptionsFromConfig(Config $config)
{
	$options = [];

	if ($visibility = $config->get('visibility')) {
		$options['predefinedAcl'] = $this->getPredefinedAclForVisibility($visibility);
	} else {
		// if a file is created without an acl, it isn't accessible via the console
		// we therefore default to private
		$options['predefinedAcl'] = $this->getPredefinedAclForVisibility(AdapterInterface::VISIBILITY_PRIVATE);
	}

	return $options;
})

The problem I have is, that only the 'visibility' argument from $config is actually parsed, additional arguments like 'chunkSize' or 'resumable' that are essential for chunked file uploads are discarded.

I would suggest adding something along the line of this, to enable those features:

if ($config->has('chunkSize')) {
	$options['chunkSize'] = $config->get('chunkSize');
}

if ($config->has('resumable')) {
	$options['resumable'] = $config->get('resumable');
}
@matthewgoslett
Copy link
Contributor

Should we just pass any other vars from the $config in the return array?

I don't see the need to explicitly check each one unless the function needs to sanitise or manipulate

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

2 participants