Skip to content

Commit 8c72051

Browse files
committed
Merge remote-tracking branch 'origin/backport/52880/stable31' into backport/52880/stable31
2 parents bc64573 + 25976e3 commit 8c72051

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

apps/files_sharing/src/files_actions/rejectShareAction.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,20 @@ export const action = new FileAction({
4141
async exec(node: Node) {
4242
try {
4343
const isRemote = !!node.attributes.remote
44-
const url = generateOcsUrl('apps/files_sharing/api/v1/{shareBase}/{id}', {
45-
shareBase: isRemote ? 'remote_shares' : 'shares',
46-
id: node.attributes.id,
47-
})
44+
const shareBase = isRemote ? 'remote_shares' : 'shares'
45+
const id = node.attributes.id
46+
let url: string
47+
if (node.attributes.accepted === 0) {
48+
url = generateOcsUrl('apps/files_sharing/api/v1/{shareBase}/pending/{id}', {
49+
shareBase,
50+
id,
51+
})
52+
} else {
53+
url = generateOcsUrl('apps/files_sharing/api/v1/{shareBase}/{id}', {
54+
shareBase,
55+
id,
56+
})
57+
}
4858
await axios.delete(url)
4959

5060
// Remove from current view

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.

dist/files_sharing-init.js.map

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

lib/private/Files/Storage/Wrapper/Encryption.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ private function copyBetweenStorage(
671671
}
672672
}
673673
} else {
674+
$source = false;
675+
$target = false;
674676
try {
675677
$source = $sourceStorage->fopen($sourceInternalPath, 'r');
676678
$target = $this->fopen($targetInternalPath, 'w');
@@ -680,10 +682,10 @@ private function copyBetweenStorage(
680682
[, $result] = \OC_Helper::streamCopy($source, $target);
681683
}
682684
} finally {
683-
if (isset($source) && $source !== false) {
685+
if ($source !== false) {
684686
fclose($source);
685687
}
686-
if (isset($target) && $target !== false) {
688+
if ($target !== false) {
687689
fclose($target);
688690
}
689691
}

tests/lib/Files/ViewTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,9 @@ private function doTestCopyRenameFail($operation) {
11851185
$storage2->method('writeStream')
11861186
->willThrowException(new GenericFileException('Failed to copy stream'));
11871187

1188+
$storage2->method('fopen')
1189+
->willReturn(false);
1190+
11881191
$storage1->mkdir('sub');
11891192
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
11901193
$storage1->mkdir('dirtomove');

0 commit comments

Comments
 (0)