Skip to content

Cannot delete folders in S3 from web interface #15447

Closed

Description

@mmarder

When trying to delete a folder in an Amazon S3 bucket thru the web interface I get the following message: "Could not delete: folder name". Deleting the folder with the Mac desktop app works fine.

The logs show the following:

{"Message":"The specified key does not exist.","Code":0,"Trace":"
#0 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Exception\/NamespaceExceptionFactory.php(76): Aws\\Common\\Exception\\NamespaceExceptionFactory->createException('Aws\\S3\\Exceptio...', Object(Guzzle\\Http\\Message\\Request), Object(Guzzle\\Http\\Message\\Response), Array)\n
#1 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Exception\/ExceptionListener.php(55): Aws\\Common\\Exception\\NamespaceExceptionFactory->fromResponse(Object(Guzzle\\Http\\Message\\Request), Object(Guzzle\\Http\\Message\\Response))\n
#2 [internal function]: Aws\\Common\\Exception\\ExceptionListener->onRequestError(Object(Guzzle\\Common\\Event), 'request.error', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n
#3 \/var\/www\/owncloud\/3rdparty\/symfony\/event-dispatcher\/Symfony\/Component\/EventDispatcher\/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\\Common\\Event), 'request.error', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n
#4 \/var\/www\/owncloud\/3rdparty\/symfony\/event-dispatcher\/Symfony\/Component\/EventDispatcher\/EventDispatcher.php(53): Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch(Array, 'request.error', Object(Guzzle\\Common\\Event))\n
#5 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Message\/Request.php(589): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch('request.error', Object(Guzzle\\Common\\Event))\n
#6 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Message\/Request.php(378): Guzzle\\Http\\Message\\Request->processResponse(Array)\n
#7 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(286): Guzzle\\Http\\Message\\Request->setState('complete', Array)\n
#8 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(244): Guzzle\\Http\\Curl\\CurlMulti->processResponse(Object(Guzzle\\Http\\Message\\Request), Object(Guzzle\\Http\\Curl\\CurlHandle), Array)\n
#9 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(227): Guzzle\\Http\\Curl\\CurlMulti->processMessages()\n
#10 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(211): Guzzle\\Http\\Curl\\CurlMulti->executeHandles()\n
#11 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(105): Guzzle\\Http\\Curl\\CurlMulti->perform()\n
#12 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMultiProxy.php(91): Guzzle\\Http\\Curl\\CurlMulti->send()\n
#13 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Client.php(282): Guzzle\\Http\\Curl\\CurlMultiProxy->send()\n
#14 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Client\/AbstractClient.php(262): Guzzle\\Http\\Client->send(Object(Guzzle\\Http\\Message\\Request))\n
#15 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\/Service\/Client.php(136): Aws\\Common\\Client\\AbstractClient->send(Object(Guzzle\\Http\\Message\\Request))\n
#16 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\/Service\/Command\/AbstractCommand.php(153): Guzzle\\Service\\Client->execute(Object(Aws\\S3\\Command\\S3Command))\n
#17 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\/Service\/Command\/AbstractCommand.php(189): Guzzle\\Service\\Command\\AbstractCommand->execute()\n
#18 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\/Service\/Client.php(76): Guzzle\\Service\\Command\\AbstractCommand->getResult()\n
#19 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Client\/AbstractClient.php(107): Guzzle\\Service\\Client->__call('GetObject', Array)\n
#20 \/var\/www\/owncloud\/apps\/files_external\/lib\/amazons3.php(370): Aws\\Common\\Client\\AbstractClient->__call('getObject', Array)\n
#21 \/var\/www\/owncloud\/apps\/files_external\/lib\/amazons3.php(370): Aws\\S3\\S3Client->getObject(Array)\n
#22 \/var\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/wrapper.php(266): OC\\Files\\Storage\\AmazonS3->fopen('resmio Manageme...', 'r')\n
#23 \/var\/www\/owncloud\/lib\/private\/files\/view.php(834): OC\\Files\\Storage\\Wrapper\\Wrapper->fopen('resmio Manageme...', 'r')\n
#24 \/var\/www\/owncloud\/lib\/private\/files\/view.php(719): OC\\Files\\View->basicOperation('fopen', '\/files\/resmiocl...', Array, 'r')\n
#25 \/var\/www\/owncloud\/lib\/private\/files\/view.php(648): OC\\Files\\View->fopen('\/files\/resmiocl...', 'r')\n
#26 \/var\/www\/owncloud\/lib\/private\/files\/view.php(642): OC\\Files\\View->copy('\/files\/resmiocl...', '\/files_trashbin...', true)\n
#27 \/var\/www\/owncloud\/lib\/private\/files\/view.php(642): OC\\Files\\View->copy('\/files\/resmiocl...', '\/files_trashbin...', true)\n
#28 \/var\/www\/owncloud\/lib\/private\/files\/view.php(522): OC\\Files\\View->copy('\/files\/resmiocl...', '\/files_trashbin...', true)\n
#29 \/var\/www\/owncloud\/apps\/files_trashbin\/lib\/trashbin.php(172): OC\\Files\\View->rename('\/files\/resmiocl...', '\/files_trashbin...')\n
#30 \/var\/www\/owncloud\/apps\/files_trashbin\/lib\/storage.php(80): OCA\\Files_Trashbin\\Trashbin::move2trash('resmiocloud\/res...')\n
#31 \/var\/www\/owncloud\/lib\/private\/files\/view.php(836): OCA\\Files_Trashbin\\Storage->unlink('resmio Manageme...')\n
#32 \/var\/www\/owncloud\/lib\/private\/files\/view.php(442): OC\\Files\\View->basicOperation('unlink', '\/resmiocloud\/re...', Array)\n
#33 \/var\/www\/owncloud\/lib\/private\/files\/filesystem.php(653): OC\\Files\\View->unlink('\/resmiocloud\/re...')\n
#34 \/var\/www\/owncloud\/apps\/files\/ajax\/delete.php(31): OC\\Files\\Filesystem::unlink('\/resmiocloud\/re...')\n
#35 \/var\/www\/owncloud\/lib\/private\/route\/route.php(135) : runtime-created function(1): require_once('\/var\/www\/ownclo...')\n
#36 [internal function]: __lambda_func(Array)\n
#37 \/var\/www\/owncloud\/lib\/private\/route\/router.php(250): call_user_func('?lambda_1762', Array)\n
#38 \/var\/www\/owncloud\/lib\/base.php(767): OC\\Route\\Router->match('\/apps\/files\/aja...')\n
#39 \/var\/www\/owncloud\/index.php(36): OC::handleRequest()\n
#40 {main}","File":"\/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Exception\/NamespaceExceptionFactory.php
","Line":91}

Ubuntu 14.04 on Digital Ocean, Owncloud 8.0.2.

Edit: reformatted exception

Activity

  1. PVince81 commented on Apr 13, 2015

    @PVince81
    Contributor

    I tried the following with v8.0.2:

    1. Mount a S3 bucket (I used one from the EU server)
    2. Create a folder "abc"
    3. Create a subfolder "abc/def"
    4. Upload a bunch of pictures into "abc/def"
    5. Delete "abc" from the web UI
    6. Check the trashbin

    Folder was deleted properly. Works for me.

    Can you tell us more about that folder ? Does it contain a lot of files ?
    Is it a specific folder or any folder that cannot be deleted ? (even an empty one)

  2. PVince81 commented on Apr 13, 2015

    @PVince81
    Contributor

    Does its path contain any special characters ?

  3. mmarder commented on Apr 13, 2015

    @mmarder
    Author

    Thank you for taking a look at this.

    Some more information:

    • S3 bucket from eu-central-1
    • The folder can be empty and it is still not working
    • Example of one of the folder names I tried "companymaterial" (so no special characters)
    • Renaming the folder works fine

    As far as I understand the error from AWS "The specified key does not exist." means that the file does not exist in the S3 bucket.

    Here are the logs which were created when I tried to delete the folder "companymaterial". There are some references to the folder name in the logs. Maybe they mean something to you.

    Exception: {"Message":"The specified key does not exist.","Code":0,"Trace":"#0 
    \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\
    /Exception\/NamespaceExceptionFactory.php(76): Aws\\Common\\Exception\\
    NamespaceExceptionFactory->createException('Aws\\S3\\Exceptio...', 
    Object(Guzzle\\Http\\Message\\Request), Object(Guzzle\\Http\\Message\\
    Response), Array)\n#1 \/var\/www\/owncloud\/apps\/files_external\
    /3rdparty\/aws-sdk-php\/Aws\/Common\/Exception\/ExceptionListener.php(55):
     Aws\\Common\\Exception\\NamespaceExceptionFactory->fromResponse(Object(Guzzle\\Http\\Message\\Request),
     Object(Guzzle\\Http\\Message\\Response))\n#2 [internal function]: 
    Aws\\Common\\Exception\\ExceptionListener->onRequestError(Object(Guzzle\\Common\\Event),
     'request.error', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#3
     \/var\/www\/owncloud\/3rdparty\/symfony\/event-dispatcher\/Symfony\/Component\
    /EventDispatcher\/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\\
    Common\\Event), 'request.error', Object(Symfony\\Component\\EventDispatcher\\EventDispatcher))\n#4
     \/var\/www\/owncloud\/3rdparty\/symfony\/event-dispatcher\/Symfony\/Component\/EventDispatcher\
    /EventDispatcher.php(53): Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch(Array, 'request.error',
     Object(Guzzle\\Common\\Event))\n#5 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Message\/Request.php(589):
     Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch('request.error',
     Object(Guzzle\\Common\\Event))\n#6 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Message\/Request.php(378):
     Guzzle\\Http\\Message\\Request->processResponse(Array)\n#7 
    \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(286):
     Guzzle\\Http\\Message\\Request->setState('complete', Array)\n#8 \/var\/www\/owncloud\
    /3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(244): Guzzle\\Http\\Curl\\
    CurlMulti->processResponse(Object(Guzzle\\Http\\Message\\Request), Object(Guzzle\\Http
    \\Curl\\CurlHandle), Array)\n#9 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\
    /Curl\/CurlMulti.php(227): Guzzle\\Http\\Curl\\CurlMulti->processMessages()\n#10 \/var\
    /www\/owncloud\/3rdparty\/guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(211): 
    Guzzle\\Http\\Curl\\CurlMulti->executeHandles()\n#11 \/var\/www\/owncloud\/3rdparty\
    /guzzle\/http\/Guzzle\/Http\/Curl\/CurlMulti.php(105): Guzzle\\Http\\Curl
    \\CurlMulti->perform()\n#12 \/var\/www\/owncloud\/3rdparty\/guzzle\/
    http\/Guzzle\/Http\/Curl\/CurlMultiProxy.php(91): Guzzle\\Http\\Curl\\
    CurlMulti->send()\n#13 \/var\/www\/owncloud\/3rdparty\/guzzle\/http\/
    Guzzle\/Http\/Client.php(282): Guzzle\\Http\\Curl\\CurlMultiProxy->send()
    \n#14 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\
    /Aws\/Common\/Client\/AbstractClient.php(262): Guzzle\\
    Http\\Client->send(Object(Guzzle\\Http\\Message\\Request))\n#15 \
    /var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\
    /Guzzle\/Service\/Client.php(136): Aws\\Common\\Client\\
    AbstractClient->send(Object(Guzzle\\Http\\Message\\Request))\n#16
     \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\
    /Guzzle\/Service\/Command\/AbstractCommand.php(153): Guzzle\\Service\\
    Client->execute(Object(Aws\\S3\\Command\\S3Command))\n#17 \/var\/www\
    /owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\
    /Service\/Command\/AbstractCommand.php(189): Guzzle\\Service\\
    Command\\AbstractCommand->execute()\n#18 \/var\/www\/owncloud\
    /apps\/files_external\/3rdparty\/aws-sdk-php\/Guzzle\/Service\
    /Client.php(76): Guzzle\\Service\\Command\\AbstractCommand->getResult()
    \n#19 \/var\/www\/owncloud\/apps\/files_external\/3rdparty\/aws-sdk-php\
    /Aws\/Common\/Client\/AbstractClient.php(107): Guzzle\\Service\\
    Client->__call('GetObject', Array)\n#20 \/var\/www\/owncloud\/apps\
    /files_external\/lib\/amazons3.php(370): Aws\\Common\\Client\\
    AbstractClient->__call('getObject', Array)\n#21 \/var\/www\
    /owncloud\/apps\/files_external\/lib\/amazons3.php(370): 
    Aws\\S3\\S3Client->getObject(Array)\n#22 \/var\/www\/owncloud\
    /lib\/private\/files\/storage\/wrapper\/wrapper.php(266): 
    OC\\Files\\Storage\\AmazonS3->fopen('companymaterial...', 'r')
    \n#23 \/var\/www\/owncloud\/lib\/private\/files\/view.php(834): 
    OC\\Files\\Storage\\Wrapper\\Wrapper->fopen('companymaterial...',
     'r')\n#24 \/var\/www\/owncloud\/lib\/private\/files\/view.php(719):
     OC\\Files\\View->basicOperation('fopen', '\/files\/resmiocl...',
     Array, 'r')\n#25 \/var\/www\/owncloud\/lib\/private\/files\/view.php(648):
     OC\\Files\\View->fopen('\/files\/resmiocl...', 'r')\n#26 \/var\/www\
    /owncloud\/lib\/private\/files\/view.php(642): OC\\Files\\View->copy
    ('\/files\/resmiocl...', '\/files_trashbin...', true)\n#27 \/var\/www
    \/owncloud\/lib\/private\/files\/view.php(522): OC\\Files\\View->copy
    ('\/files\/resmiocl...', '\/files_trashbin...', true)\n#28 \/var\/www\
    /owncloud\/apps\/files_trashbin\/lib\/trashbin.php(172): OC\\Files\\
    View->rename('\/files\/resmiocl...', '\/files_trashbin...')\n#29 \/var
    \/www\/owncloud\/apps\/files_trashbin\/lib\/storage.php(80): OCA\\
    Files_Trashbin\\Trashbin::move2trash('resmiocloud\/com...')\n#30 \
    /var\/www\/owncloud\/lib\/private\/files\/view.php(836): OCA\\
    Files_Trashbin\\Storage->unlink('companymaterial')\n#31 \/var\
    /www\/owncloud\/lib\/private\/files\/view.php(442): OC\\Files\\
    View->basicOperation('unlink', '\/resmiocloud\/co...', Array)\n#32 \
    /var\/www\/owncloud\/lib\/private\/files\/filesystem.php(653): OC\\
    Files\\View->unlink('\/resmiocloud\/co...')\n#33 \/var\/www\/owncloud\
    /apps\/files\/ajax\/delete.php(31): OC\\Files\\Filesystem::unlink('\
    /resmiocloud\/co...')\n#34 \/var\/www\/owncloud\/lib\/private\/route\
    /route.php(135) : runtime-created function(1): require_once('\/var\/www\
    /ownclo...')\n#35 [internal function]: __lambda_func(Array)\n#36 \/var\
    /www\/owncloud\/lib\/private\/route\/router.php(250): call_user_func
    ('?lambda_884', Array)\n#37 \/var\/www\/owncloud\/lib\/base.php(767): 
    OC\\Route\\Router->match('\/apps\/files\/aja...')\n#38 \/var\/www\/owncloud\
    /index.php(36): OC::handleRequest()\n#39 {main}","File":"\/var\/www\/owncloud\
    /apps\/files_external\/3rdparty\/aws-sdk-php\/Aws\/Common\/Exception\/NamespaceExceptionFactory.php","Line":91}
    
  4. PVince81 commented on Apr 13, 2015

    @PVince81
    Contributor

    Can you confirm that the folder really exists by looking at the S3 web interface ? Does the folder appear there with the proper name ? If I remember well, the folder entry should have a trailing slash, so it should read "companymaterial/"

  5. mmarder commented on Apr 13, 2015

    @mmarder
    Author

    bildschirmfoto 2015-04-13 um 13 37 18

    The folder looks fine in S3, but I don't have a trailing slash.

  6. PVince81 commented on Apr 13, 2015

    @PVince81
    Contributor

    Okay. Either that's the problem or maybe S3 is clever enough to interpret it as a folder (note: I'm not a S3 expert at all)

  7. musicullum commented on Jun 5, 2015

    @musicullum

    I have a (possibly related) problem with the s3 php stream wrapper:

    if (file_exists ($key)) {
    if (unlink ($key) === FALSE)

    ... never gets here

    So it recognises the key and returns a successful deletion of the key (which has only a-z characters lowercase), but the "folder" is still present and accessible as seen in the S3 Management Console.

    What am I missing?

  8. PVince81 commented on Jun 15, 2015

    @PVince81
    Contributor

    I managed to reproduce this once. The folder disappeared from the web UI.

    Can you guys try the following patch #16938 ?

    It seems that the S3 backend returned the folder itself in the list of folders. So basically if you had a folder "abc/" it would think there's a folder "abc/abc". So when deleting that folder, it would try to recurse into it but obviously that folder does not exist.

    The PR above is likely to fix your issues.

  9. added this to the milestone on Jun 15, 2015
  10. MorrisJobke commented on Jun 16, 2015

    @MorrisJobke
    Contributor

    Fixed via #16938

  11. locked as resolved and limited conversation to collaborators on Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions