mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 16:39:59 -04:00
Merge pull request #52077 from nextcloud/backport/52075/stable30
This commit is contained in:
commit
6f5fc70df4
13 changed files with 28 additions and 12 deletions
|
|
@ -47,6 +47,7 @@ use OCP\Lock\ILockingProvider;
|
|||
use OCP\Lock\LockedException;
|
||||
use OCP\Mail\IMailer;
|
||||
use OCP\Server;
|
||||
use OCP\Share\Exceptions\GenericShareException;
|
||||
use OCP\Share\Exceptions\ShareNotFound;
|
||||
use OCP\Share\IManager;
|
||||
use OCP\Share\IProviderFactory;
|
||||
|
|
@ -794,6 +795,9 @@ class ShareAPIController extends OCSController {
|
|||
} catch (HintException $e) {
|
||||
$code = $e->getCode() === 0 ? 403 : $e->getCode();
|
||||
throw new OCSException($e->getHint(), $code);
|
||||
} catch (GenericShareException|\InvalidArgumentException $e) {
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
throw new OCSForbiddenException($e->getMessage(), $e);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
throw new OCSForbiddenException('Failed to create share.', $e);
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@
|
|||
// TODO: remove when ie not supported
|
||||
import 'url-search-params-polyfill'
|
||||
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { generateOcsUrl } from '@nextcloud/router'
|
||||
import axios from '@nextcloud/axios'
|
||||
|
||||
import Share from '../models/Share.ts'
|
||||
import { emit } from '@nextcloud/event-bus'
|
||||
|
||||
const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares')
|
||||
|
||||
|
|
@ -45,7 +47,7 @@ export default {
|
|||
} catch (error) {
|
||||
console.error('Error while creating share', error)
|
||||
const errorMessage = error?.response?.data?.ocs?.meta?.message
|
||||
OC.Notification.showTemporary(
|
||||
showError(
|
||||
errorMessage ? t('files_sharing', 'Error creating the share: {errorMessage}', { errorMessage }) : t('files_sharing', 'Error creating the share'),
|
||||
{ type: 'error' },
|
||||
)
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@
|
|||
</NcButton>
|
||||
<NcButton type="primary"
|
||||
data-cy-files-sharing-share-editor-action="save"
|
||||
:disabled="creating"
|
||||
@click="saveShare">
|
||||
{{ shareButtonText }}
|
||||
<template v-if="creating" #icon>
|
||||
|
|
@ -911,8 +912,16 @@ export default {
|
|||
incomingShare.password = this.share.password
|
||||
}
|
||||
|
||||
this.creating = true
|
||||
const share = await this.addShare(incomingShare)
|
||||
let share
|
||||
try {
|
||||
this.creating = true
|
||||
share = await this.addShare(incomingShare)
|
||||
} catch (error) {
|
||||
this.creating = false
|
||||
// Error is already handled by ShareRequests mixin
|
||||
return
|
||||
}
|
||||
|
||||
// ugly hack to make code work - we need the id to be set but at the same time we need to keep values we want to update
|
||||
this.share._share.id = share.id
|
||||
await this.queueUpdate(...permissionsAndAttributes)
|
||||
|
|
@ -926,6 +935,7 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.share = share
|
||||
this.creating = false
|
||||
this.$emit('add:share', this.share)
|
||||
|
|
|
|||
2
dist/3204-3204.js
vendored
2
dist/3204-3204.js
vendored
File diff suppressed because one or more lines are too long
1
dist/3204-3204.js.map
vendored
1
dist/3204-3204.js.map
vendored
File diff suppressed because one or more lines are too long
1
dist/3204-3204.js.map.license
vendored
1
dist/3204-3204.js.map.license
vendored
|
|
@ -1 +0,0 @@
|
|||
3204-3204.js.license
|
||||
2
dist/7161-7161.js
vendored
Normal file
2
dist/7161-7161.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/7161-7161.js.map
vendored
Normal file
1
dist/7161-7161.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/7161-7161.js.map.license
vendored
Symbolic link
1
dist/7161-7161.js.map.license
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
7161-7161.js.license
|
||||
4
dist/files_sharing-files_sharing_tab.js
vendored
4
dist/files_sharing-files_sharing_tab.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_sharing-files_sharing_tab.js.map
vendored
2
dist/files_sharing-files_sharing_tab.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -2256,7 +2256,7 @@ class ManagerTest extends \Test\TestCase {
|
|||
|
||||
public function testPathCreateChecksContainsSharedMount() {
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Path contains files shared with you');
|
||||
$this->expectExceptionMessage('You cannot share a folder that contains other shares');
|
||||
|
||||
$path = $this->createMock(Folder::class);
|
||||
$path->method('getPath')->willReturn('path');
|
||||
|
|
|
|||
Loading…
Reference in a new issue