Skip to content

[Bug]: Unable to update token for email shares #53442

Open
@DodoLeDev

Description

@DodoLeDev

⚠️ This issue respects the following points: ⚠️

Bug description

After digging into this pull request, I found (and tested to be sure) that you can't update the token of a mail share.

TLDR: The bug is here

Steps to reproduce

Tip

Checkout the OCS Share API for more info (you'll see that it's out of date)

  1. Create a link share from the GUI or through the API (POST <hostname>/ocs/v2.php/apps/files_sharing/api/v1/shares) (shareType = 3)
  2. Update the token through the GUI or API (PUT <hostname>/ocs/v2.php/apps/files_sharing/api/v1/shares/<shareID>)
  3. It works.

Now if we do the same with mail shares:

  1. Create a link share from the GUI or through the API (POST <hostname>/ocs/v2.php/apps/files_sharing/api/v1/shares) (shareType = 4)
  2. Update the token through the GUI or API (PUT <hostname>/ocs/v2.php/apps/files_sharing/api/v1/shares/<shareID>)
  3. Now it's more subtle, because the server returns that the token have been updated:
<?xml version="1.0"?>
<ocs>
 <meta>
  <status>ok</status>
  <statuscode>200</statuscode>
  <message>OK</message>
 </meta>
 <data>
  <id>1</id>
  <share_type>4</share_type>
  ...
  <token>cust0mTok3n</token>
  ...
 </data>
</ocs>
  1. But now just request data about the share through GUI or API (GET <hostname>/ocs/v2.php/apps/files_sharing/api/v1/shares/<shareID>), and you'll find out that the token is still the original one

Expected behavior

Sharing with mail should offer the ability to edit the token, just like how sharing with link works.
Everything is ready to do that, but in practice, the server does not care about the provided token

Nextcloud Server version

master

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

I haven't filled in the details of my installation because I provided you with the location of the bug in the 'master' branch (as of 11 June 2025), so I don't think it would be helpful to provide any more information.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions