Skip to content

Commit f4841e1

Browse files
authored
Merge pull request #52072 from nextcloud/fix/sharing-exp-date
2 parents a75f47f + f7cb282 commit f4841e1

File tree

12 files changed

+55
-13
lines changed

12 files changed

+55
-13
lines changed

apps/files_sharing/src/components/NewFileRequestDialog.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ export default defineComponent({
296296
path: this.destination,
297297
note: this.note,
298298
299-
password: this.password || undefined,
300-
expireDate: expireDate || undefined,
299+
password: this.password || '',
300+
expireDate: expireDate || '',
301301
302302
// Empty string
303303
shareWith: '',

build/integration/features/bootstrap/Sharing.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ public function asCreatingAShareWith($user, $body) {
5454
$fd = $body->getRowsHash();
5555
if (array_key_exists('expireDate', $fd)) {
5656
$dateModification = $fd['expireDate'];
57-
if (!empty($dateModification)) {
57+
if ($dateModification === 'null') {
58+
$fd['expireDate'] = null;
59+
} elseif (!empty($dateModification)) {
5860
$fd['expireDate'] = date('Y-m-d', strtotime($dateModification));
61+
} else {
62+
$fd['expireDate'] = '';
5963
}
6064
}
6165
$options['form_params'] = $fd;

build/integration/sharing_features/sharing-v1.feature

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,11 @@ Feature: sharing
231231
| url | AN_URL |
232232
| mimetype | httpd/unix-directory |
233233

234-
Scenario: Creating a new share with expiration date removed, when default expiration is set
234+
Scenario: Creating a new share with expiration date empty, when default expiration is set
235235
Given user "user0" exists
236236
And user "user1" exists
237-
And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
237+
And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
238+
And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
238239
And As an "user0"
239240
When creating a share with
240241
| path | welcome.txt |
@@ -249,6 +250,43 @@ Feature: sharing
249250
And Share fields of last share match with
250251
| expiration ||
251252

253+
Scenario: Creating a new share with expiration date removed, when default expiration is set
254+
Given user "user0" exists
255+
And user "user1" exists
256+
And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
257+
And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
258+
And As an "user0"
259+
When creating a share with
260+
| path | welcome.txt |
261+
| shareWith | user1 |
262+
| shareType | 0 |
263+
Then the OCS status code should be "100"
264+
And the HTTP status code should be "200"
265+
And Getting info of last share
266+
Then the OCS status code should be "100"
267+
And the HTTP status code should be "200"
268+
And Share fields of last share match with
269+
| expiration | +3 days |
270+
271+
Scenario: Creating a new share with expiration date null, when default expiration is set
272+
Given user "user0" exists
273+
And user "user1" exists
274+
And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
275+
And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
276+
And As an "user0"
277+
When creating a share with
278+
| path | welcome.txt |
279+
| shareWith | user1 |
280+
| shareType | 0 |
281+
| expireDate | null |
282+
Then the OCS status code should be "100"
283+
And the HTTP status code should be "200"
284+
And Getting info of last share
285+
Then the OCS status code should be "100"
286+
And the HTTP status code should be "200"
287+
And Share fields of last share match with
288+
| expiration | +3 days |
289+
252290
Scenario: Creating a new public share, updating its password and getting its info
253291
Given user "user0" exists
254292
And As an "user0"

dist/3456-3456.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/3456-3456.js.map.license

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/4039-4039.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/4039-4039.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4039-4039.js.license

dist/files_sharing-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)