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

Flushing the document server fails for group folders #110

Closed
stweil opened this issue Apr 5, 2020 · 8 comments
Closed

Flushing the document server fails for group folders #110

stweil opened this issue Apr 5, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@stweil
Copy link
Member

stweil commented Apr 5, 2020

Flushing the document server is essential to get changes made in OnlyOffice written back to the Nextcloud filesystem. It no longer works as soon as group folders are involved. This does not only affect the files modified in the group folder, but also all other files which were edited in OnlyOffice. Possibly related issues with the same of other reasons which prevent flushing of changes: #12, #79, #96, #100, #107 .

Steps to reproduce the issue:

  1. Create a group folder group.
  2. Add a subfolder group/demo.
  3. Share group/demowith a link which allows read/write access.
  4. Create a table test in the shared subfolder using the link.
  5. Change test with OnlyOffice.

Now flushing with sudo -u www-data php occ documentserver:flush no longer works. It fails with an unhandled exception:

An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /cloud/lib/private/Files/View.php:1690
Stack trace:
#0 /cloud/lib/private/Files/Filesystem.php(907): OC\Files\View->getOwner('/group/demo/tes...')
#1 /cloud/apps/files_versions/lib/Storage.php(101): OC\Files\Filesystem::getOwner('/group/demo/tes...')
[...]
@stweil
Copy link
Member Author

stweil commented Apr 5, 2020

Maybe files created using a share link simply don't have an owner?

@stweil
Copy link
Member Author

stweil commented Apr 5, 2020

It seems to work using this modified getUID function in lib/private/Files/View.php:

    /**
     * Get the owner for a file or folder
     *
     * @param string $path
     * @return string the user id of the owner
     * @throws NotFoundException
     */
    public function getOwner($path) {
            $info = $this->getFileInfo($path);
            if (!$info) {
                    throw new NotFoundException($path . ' not found while trying to get owner');
            }
            $owner = $info->getOwner();
            return $owner !== null ? $owner->getUID() : false;
    }

@stweil
Copy link
Member Author

stweil commented Apr 5, 2020

It looks like this issue was fixed recently by commit nextcloud/server@3443a00.

So hopefully we just have to wait for an official release which includes that commit.

@stweil stweil added the bug Something isn't working label Apr 5, 2020
stweil referenced this issue in nextcloud/server Apr 5, 2020
Else this can error out on storages that do not have an owner (e.g.
groupfolders).

Signed-off-by: Roeland Jago Douma <[email protected]>
@stweil
Copy link
Member Author

stweil commented Apr 5, 2020

The modification in getOwner was sufficient for my test scenario, but did not fix the error on a production system: After patching the local Nextcloud server installation with the commit above, I get a new error when flushing the document server:

# sudo -u www-data php occ documentserver:flush

In ConverterBinary.php line 64:
                                                                                                                                                                                    
  change_code: a?this.Nb.splice(d+1,this.Nb[0]-d):this.Nb[0]!==d+1&&0!==a&&(this.Nb.splice(d+2,this.Nb[0]-d-1),this.Nb[0]=d+1)}0===a&&this.Nb[0]!==d+1&&(this.Nb.splice(d+1,0,this  
  .Nb.length-d-1),this.Nb[0]=d+1);c=1+this.Nb[0]+this.Nb[d+1]+2*a;this.Nb[c+0]=0;this.Nb[c+1]=0;return 0!==d||0!==a?this.Nb[c-1]:0};nb.prototype.saa=function(d,a,c,e){d=this.lxb(  
  d,a);this.Nb[d+0]=c;this.Nb[d+1]=e};nb.prototype.qYb=function(d,a,c){this.Nb[this.lxb(d,a)+1]=c};nb.prototype.BG=function(){this.bb&&(this.bb.ey.b8d(),this.bb.kd.Z7a(Kl))};      
  change: Uncaught TypeError: Cannot read property 'b8d' of undefined                                                                                                               
  DoctRenderer:<result><error index="717" /></result>                                                                                                                               
                                                                                                                                                                                    

documentserver:flush [--output [OUTPUT]]

@stweil stweil changed the title Flushing the document server fails for group folders shared by link Flushing the document server fails for group folders Apr 5, 2020
@stweil
Copy link
Member Author

stweil commented Apr 5, 2020

@icewind1991, do you have a suggestion how to examine or fix the problem in ConverterBinary.php? Issue #88 is possibly related.

@stweil
Copy link
Member Author

stweil commented Apr 6, 2020

Removing the files which cause the problem in ConverterBinary.php helps as a workaround:

mv /var/www/html/nextcloud/data/appdata_*/documentserver_community/doc_* /var/tmp/

@stweil
Copy link
Member Author

stweil commented Apr 24, 2020

The fix is now part of the latest stable release, so this issue can be closed.

@dzzun-ops
Copy link

the only thing that helped me was setup document server in with docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants