owncloud / files_primary_s3

📦 S3 compatible Storage
GNU General Public License v2.0
16 stars 5 forks source link

Restoring a previous version of a shared file fails #53

Open butonic opened 6 years ago

butonic commented 6 years ago

As admin create a text file and edit it a few times to create multiple versions As admin share the text file with foo As foo try to revert to a previous version

It should restore the version but this is what is logged

Error executing "CopyObject" on "http://core:8000/owncloud/urn%3Aoid%3A62"; AWS HTTP error: Client error response [url] http://core:8000/owncloud/urn%3Aoid%3A62 [status code] 400 [reason phrase] Bad Request InvalidRequest (client): This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes. - 
<Error>
<Code>InvalidRequest</Code>
<Message>This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.</Message>

full log:

{"reqId":"GCmnNhHOxeRW3Jj3ARzU","level":4,"time":"2018-05-04T12:41:21+02:00","remoteAddr":"127.0.0.1","user":"foo","app":"webdav","method":"COPY","url":"\/remote.php\/dav\/meta\/62\/v\/3938343734353639353839393235393939393939524730303120203839","message":"Exception: {\"Message\":\"Error executing \\\"CopyObject\\\" on \\\"http://core:8000/owncloud/urn%3Aoid%3A62\\\"; AWS HTTP error: Client error response [url] http://core:8000/owncloud/urn%3Aoid%3A62 [status code] 400 [reason phrase] Bad Request InvalidRequest (client): This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes. - <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><Error><Code>InvalidRequest</Code><Message>This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.</Message><Resource></Resource><RequestId>c56ab9fedd4388383114</RequestId></Error>\",\"Exception\":\"Aws\S3\Exception\S3Exception\",\"Code\":0,\"Trace\":\"#0 /var/www/html/core/apps-repos/files_primary_s3/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(100): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command), Array)
#1 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(203): Aws\WrappedHttpHandler->Aws\{closure}(Array)
#2 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(174): GuzzleHttp\Promise\Promise::callHandler(2, Array, Array)
#3 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/RejectedPromise.php(40): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Array)
#4 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()
#5 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\Promise\TaskQueue->run(true)
#6 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#7 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#8 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#9 /var/www/html/core/apps-repos/files_primary_s3/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#10 /var/www/html/core/apps-repos/files_primary_s3/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#11 /var/www/html/core/apps-repos/files_primary_s3/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(77): Aws\AwsClient->execute(Object(Aws\Command))
#12 /var/www/html/core/apps-repos/files_primary_s3/lib/s3storage.php(273): Aws\AwsClient->__call('copyObject', Array)
#13 /var/www/html/core/lib/private/Files/ObjectStore/ObjectStoreStorage.php(521): OCA\Files_Primary_S3\S3Storage->restoreVersion('urn:oid:62', '393834373435363...')
#14 /var/www/html/core/lib/private/Files/Storage/Wrapper/Wrapper.php(500): OC\Files\ObjectStore\ObjectStoreStorage->restoreVersion('files/New text ...', '393834373435363...')
#15 /var/www/html/core/lib/private/Files/Storage/Wrapper/Wrapper.php(500): OC\Files\Storage\Wrapper\Wrapper->__call('restoreVersion', Array)
#16 /var/www/html/core/lib/private/Files/Storage/Wrapper/Wrapper.php(500): OC\Files\Storage\Wrapper\Wrapper->__call('restoreVersion', Array)
#17 /var/www/html/core/lib/private/Files/Storage/Wrapper/Wrapper.php(500): OC\Files\Storage\Wrapper\Wrapper->__call('restoreVersion', Array)
#18 /var/www/html/core/lib/private/Files/Meta/MetaFileVersionNode.php(110): OC\Files\Storage\Wrapper\Wrapper->__call('restoreVersion', Array)
#19 /var/www/html/core/apps/dav/lib/Meta/MetaFile.php(98): OC\Files\Meta\MetaFileVersionNode->copy('/foo/files/New ...')
#20 /var/www/html/core/apps/dav/lib/DAV/CopyPlugin.php(83): OCA\DAV\Meta\MetaFile->copy('/foo/files/New ...')
#21 [internal function]: OCA\DAV\DAV\CopyPlugin->httpCopy(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
#22 /var/www/html/core/lib/composer/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)
#23 /var/www/html/core/lib/composer/sabre/dav/lib/DAV/Server.php(479): Sabre\Event\EventEmitter->emit('method:COPY', Array)
#24 /var/www/html/core/lib/composer/sabre/dav/lib/DAV/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
#25 /var/www/html/core/apps/dav/lib/Server.php(291): Sabre\DAV\Server->exec()
#26 /var/www/html/core/apps/dav/appinfo/v2/remote.php(31): OCA\DAV\Server->exec()
#27 /var/www/html/core/remote.php(175): require_once('/var/www/html/c...')
#28 {main}\",\"File\":\"/var/www/html/core/apps-repos/files_primary_s3/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php\",\"Line\":191,\"User\":\"foo\"}"}

and the web ui shows a yellow notification: Failed to revert /New text file.txt to revision May 4, 2018 12:40 PM.

patrickjahns commented 6 years ago

@butonic

Please provide more information on the objectstore used

butonic commented 6 years ago

I was using @DeepDiver1975 s scality docker image: deepdiver/s3server:7.1

patrickjahns commented 6 years ago

@phil-davis can you check if we generally have a scenario testing to restore a version of a previously shared file?

patrickjahns commented 6 years ago

@davitol can you try to reproduce

davitol commented 6 years ago

@davitol can you try to reproduce

I cannot reproduce it. I tried with Scality and it seems to work for me. The file is restore. But I have seen that previews are not properly refresh using scality. The Thumbnail and the content of the file.txt do not match

PVince81 commented 6 years ago

@davitol please verify again with latest versions

davitol commented 5 years ago

Tested with 10.0.10 EE tarball (files_primary_s3: 1.0.0) and keeps failing:

{"reqId":"9glHC12mlycQqly5meLb","level":4,"time":"2018-10-19T10:33:57+00:00","remoteAddr":"172.29.0.1","user":"foo","app":"webdav","method":"COPY","url":"\/remote.php\/dav\/meta\/23\/v\/39383436303035353336393236353939393939395247303031202031","message":"Exception: Error executing \"CopyObject\" on \"http:\/\/s3server:8000\/owncloud\/urn%3Aoid%3A23\"; AWS HTTP error: Client error response [url] http:\/\/s3server:8000\/owncloud\/urn%3Aoid%3A23 [status code] 400 [reason phrase] Bad Request InvalidRequest (client): This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes. - <?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>InvalidRequest<\/Code><Message>This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.<\/Message><Resource><\/Resource><RequestId>59ddcfbcf348955ad375<\/RequestId><\/Error>: {\"Exception\":\"Aws\\\\S3\\\\Exception\\\\S3Exception\",\"Message\":\"Error executing \\\"CopyObject\\\" on \\\"http:\\\/\\\/s3server:8000\\\/owncloud\\\/urn%3Aoid%3A23\\\"; AWS HTTP error: Client error response [url] http:\\\/\\\/s3server:8000\\\/owncloud\\\/urn%3Aoid%3A23 [status code] 400 [reason phrase] Bad Request InvalidRequest (client): This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes. - <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><Error><Code>InvalidRequest<\\\/Code><Message>This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes.<\\\/Message><Resource><\\\/Resource><RequestId>59ddcfbcf348955ad375<\\\/RequestId><\\\/Error>\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/WrappedHttpHandler.php(100): Aws\\\\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\\\\Psr7\\\\Request), Object(Aws\\\\Command), Array)\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(203): Aws\\\\WrappedHttpHandler->Aws\\\\{closure}(Array)\\n#2 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(174): GuzzleHttp\\\\Promise\\\\Promise::callHandler(2, Array, Array)\\n#3 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/RejectedPromise.php(40): GuzzleHttp\\\\Promise\\\\Promise::GuzzleHttp\\\\Promise\\\\{closure}(Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/TaskQueue.php(47): GuzzleHttp\\\\Promise\\\\RejectedPromise::GuzzleHttp\\\\Promise\\\\{closure}()\\n#5 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(246): GuzzleHttp\\\\Promise\\\\TaskQueue->run(true)\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(223): GuzzleHttp\\\\Promise\\\\Promise->invokeWaitFn()\\n#7 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(267): GuzzleHttp\\\\Promise\\\\Promise->waitIfPending()\\n#8 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(225): GuzzleHttp\\\\Promise\\\\Promise->invokeWaitList()\\n#9 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(62): GuzzleHttp\\\\Promise\\\\Promise->waitIfPending()\\n#10 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/AwsClientTrait.php(58): GuzzleHttp\\\\Promise\\\\Promise->wait()\\n#11 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/AwsClientTrait.php(77): Aws\\\\AwsClient->execute(Object(Aws\\\\Command))\\n#12 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/lib\\\/s3storage.php(244): Aws\\\\AwsClient->__call('copyObject', Array)\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/ObjectStore\\\/ObjectStoreStorage.php(500): OCA\\\\Files_Primary_S3\\\\S3Storage->restoreVersion('urn:oid:23', '393834363030353...')\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(500): OC\\\\Files\\\\ObjectStore\\\\ObjectStoreStorage->restoreVersion('files\\\/Pepe.txt', '393834363030353...')\\n#15 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(500): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->__call('restoreVersion', Array)\\n#16 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(500): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->__call('restoreVersion', Array)\\n#17 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(500): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->__call('restoreVersion', Array)\\n#18 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(500): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->__call('restoreVersion', Array)\\n#19 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Meta\\\/MetaFileVersionNode.php(111): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->__call('restoreVersion', Array)\\n#20 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Meta\\\/MetaFile.php(98): OC\\\\Files\\\\Meta\\\\MetaFileVersionNode->copy('\\\/foo\\\/files\\\/Pepe...')\\n#21 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/DAV\\\/CopyPlugin.php(87): OCA\\\\DAV\\\\Meta\\\\MetaFile->copy('\\\/foo\\\/files\\\/Pepe...')\\n#22 [internal function]: OCA\\\\DAV\\\\DAV\\\\CopyPlugin->httpCopy(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#23 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#24 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:COPY', Array)\\n#25 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#26 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(298): Sabre\\\\DAV\\\\Server->exec()\\n#27 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#28 \\\/var\\\/www\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/ownclo...')\\n#29 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/WrappedHttpHandler.php\",\"Line\":191}"}
DeepDiver1975 commented 1 year ago

needs an acceptance test in core .....

phil-davis commented 12 months ago

needs an acceptance test in core .....

I will have a look.