Hello, everyone.
I’m a developer of Seafile and I’m developing file/folder sharing between Seafile and Nextcloud via OCM protocol.
I can share a file to Nextcloud now, but when user in Nextcloud open this file, Nextcloud will send this two requests to Seafile
PROPFIND /public.php/webdav/
GET /status.php
My question is:
Is this two requests necessary?
Can the uri /public.php/webdav/
and /status.php
be changed to other string? As Seafile uses Python to implement the WebDAV protocol, NOT php.
Looking forward to your response.
Thanks.
just
November 16, 2022, 2:12pm
2
Hello, dev community chat at Nextcloud
Feel free to link your post there
Hi @lian-Seafile
Let me give you some background about the requests.
/status.php
is requested to check if the server is a Nextcloud server, as there is some additional handling of checking if the share is still available.
try {
$this->getShareInfo();
} catch (NotFoundException $e) {
// a 404 can either mean that the share no longer exists or there is no Nextcloud on the remote
if ($this->testRemote()) {
// valid Nextcloud instance means that the public share no longer exists
// since this is permanent (re-sharing the file will create a new token)
// we remove the invalid storage
$this->manager->removeShare($this->mountPoint);
$this->manager->getMountManager()->removeMount($this->mountPoint);
throw new StorageInvalidException("Remote share not found", 0, $e);
} else {
// Nextcloud instance is gone, likely to be a temporary server configuration error
throw new StorageNotAvailableException("No nextcloud instance found at remote", 0, $e);
}
} catch (ForbiddenException $e) {
There is currently no way to work around that, but maybe @bjoern can share some light what the reason for the special handling was and if that is something that would be possible with OCM already.
The URI of /public.php/webdav
seems ot be the fallback in case that endpoint discovery does not return a value:
[$protocol, $remote] = explode('://', $this->cloudId->getRemote());
if (strpos($remote, '/')) {
[$host, $root] = explode('/', $remote, 2);
} else {
$host = $remote;
$root = '';
}
$secure = $protocol === 'https';
$federatedSharingEndpoints = $discoveryService->discover($this->cloudId->getRemote(), 'FEDERATED_SHARING');
$webDavEndpoint = isset($federatedSharingEndpoints['webdav']) ? $federatedSharingEndpoints['webdav'] : '/public.php/webdav';
$root = rtrim($root, '/') . $webDavEndpoint;
$this->mountPoint = $options['mountpoint'];
$this->token = $options['token'];
parent::__construct([
'secure' => $secure,
'host' => $host,
'root' => $root,
'user' => $options['token'],
'password' => (string)$options['password']
I could only find a reference in the proposal discussion, but this would be https://github.com/cs3org/OCM-API/pull/37
Hope this helps. Let me know if there are any further questions.
2 Likes
Thanks for your reply.
So, this two api /status.php
and /public.php/webdav
are used specific for OCM share between Nextcloud servers?
Now Seafile can:
1, receive share from Nextcloud.
2, open shared file from Nextcloud on Seafile side.
3, share file to Nextcloud.
but when I try to let Nextcloud user can open shared file from Seafile on Nextcloud side, I encountered the problem.
How can I finish the last step without using /status.php
or /public.php/webdav
?