I have tested it with ONLYOFFICE and get the same problem. If i share the directory i can not access the file with ONLYOFFICE. Only if i share the file directly the file is opened with ONLYOFFICE.
But i find this discussion and it is maybe a solution for you if you have access to the source code.