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

Error creating new directories #24

Closed
paulcanning opened this issue May 16, 2016 · 4 comments
Closed

Error creating new directories #24

paulcanning opened this issue May 16, 2016 · 4 comments
Labels

Comments

@paulcanning
Copy link

Using elFinder to create a new directory in the root of a bucket, an error is thrown.

Whilst elFinder shows an error, the directory is actually created in the GCS (checked using the GCS console).

I think the problem is with this adapter though.

In the upload() method, uploadType is always set as media which may cause a conflict with elFinder.

It also seems to always want to set data to $contents, which is passed an empty string via createDir() which again is likely to cause issues?

@matthewgoslett
Copy link
Contributor

GCS has no real concept of folder vs files, everything is really just an object.
To create what looks like a folder, it's just an empty object with a trailing /.
I'm not sure why elFinder would be choking, but my sample code seems to test fine:

$newDir = $filesystem->createDir('new_directory_test');
var_dump($newDir);
var_dump($filesystem->listContents('new_directory_test'));

$objects = $filesystem->listContents();
foreach ($objects as $object) {
    if ($object['path'] == 'new_directory_test') {
        var_dump($object);
    }
}

bool(true)
array(0) {
}
array(8) {
  ["type"]=>
  string(3) "dir"
  ["dirname"]=>
  string(0) ""
  ["path"]=>
  string(18) "new_directory_test"
  ["timestamp"]=>
  int(1463657952)
  ["mimetype"]=>
  string(10) "text/plain"
  ["size"]=>
  string(1) "0"
  ["basename"]=>
  string(18) "new_directory_test"
  ["filename"]=>
  string(18) "new_directory_test"
}

The only thing which may be odd to elFinder is the mimetype. The upload() function calls Util::guessMimeType which returns 'text/plain' for empty string; so directories are created with mimetype 'text/plain'. If I create a folder via the GCS console, folders are created with mimetype 'application/x-www-form-urlencoded;charset=UTF-8'. I'm not 100% sure this would be the issue though.

Could this also be related to #23

@paulcanning
Copy link
Author

I think it could have been connected the the bucket ACL, but I can't remember

@matthewgoslett
Copy link
Contributor

Can you please test if this is still happening, so that we can mark this as resolved?

@paulcanning
Copy link
Author

Sorry, I'll try and check this week for you.

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

No branches or pull requests

2 participants