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

Uploading new file to Azure Blob Storage with metadata fails on metadata write #537

Open
OJezu opened this issue Nov 1, 2017 · 1 comment
Assignees

Comments

@OJezu
Copy link

OJezu commented Nov 1, 2017

Gaufrette tries to save metadata before uploading the file itself. Alas, if there is no file before that API call for setting metadata will fail on all providers who don't support setting metadata on non-existent file/blob.

<?php
(...)
        $gaufretteFile = new File($path, $filesystem);
        $gaufretteFile->setContent('content', ['contentType' => 'what/ever']);

results in:

Uncaught PHP Exception RuntimeException: "Failed to set metadata for blob "$path" in container "$container": The specified blob does not exist. (BlobNotFound)."

As can be seen in Gaufrette/File::setContent

        $this->content = $content;
        $this->setMetadata($metadata);

        return $this->size = $this->filesystem->write($this->key, $this->content, true);

setMetadata is causing filesystem beneath to issue a metadata write, which fails.

tech-ec added a commit to tech-ec/VichUploaderBundle that referenced this issue Mar 9, 2018
@xixi773
Copy link

xixi773 commented Feb 6, 2019

This fix works if someone can merge it. =)

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

4 participants