Skip to content

[Bug]: Shares created with "Create file request" and unticked "expiration date" have the expiration date set. #52064

Closed
@oleksandr-nc

Description

@oleksandr-nc

⚠️ This issue respects the following points: ⚠️

Bug description

Shares via the "Create file request" feature are created with "expiration time", even if the expiration time is removed from the UI"

Steps to reproduce

  1. Go to Administrations settings->Sharing and enable "Set default expiration date for share via link or email"
  2. In Files App click New->Create file request
  3. Untick "Set a submission expiration date" during creation.
  4. Share is created with "expiration date" althougth the checkbox was unticked and the "Enforce expiration date" is not enabled.

Expected behavior

Share should be created without "expiration date"

Nextcloud Server version

master

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

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

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

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

Reproducable on both master and stable30 branches.

Request is send correctly from Frontend to Backend without expireDate present:

POST https://stable30.local/ocs/v2.php/apps/files_sharing/api/v1/shares:

{"shareType":4,"permissions":4,"label":"","path":"/avx","note":"","shareWith":"","attributes":"[{\"value\":true,\"key\":\"enabled\",\"scope\":\"fileRequest\"}]"}

Problem is somewhere in the backend, imho.

Edited: Found such code in the backend:

// Expire date checks
// Normally, null means no expiration date but we still set the default for backwards compatibility
// If the client sends an empty string, we set noExpirationDate to true
if ($expireDate !== null) {
if ($expireDate !== '') {
try {
$expireDateTime = $this->parseDate($expireDate);
$share->setExpirationDate($expireDateTime);
} catch (\Exception $e) {
throw new OCSNotFoundException($e->getMessage(), $e);
}
} else {
// Client sent empty string for expire date.
// Set noExpirationDate to true so overwrite is prevented.
$share->setNoExpirationDate(true);
}
}

Looks like I was wrong, and it is Frontend, that should sent an empty string in expireDate

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions