mirror of
https://github.com/nextcloud/server.git
synced 2026-03-27 04:43:20 -04:00
Restore old behaviour of sending flase for not found apps
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
eb1a69d627
commit
f9efc410fa
2 changed files with 58 additions and 74 deletions
|
|
@ -36,6 +36,7 @@ namespace OC\Template;
|
|||
use bantu\IniGetWrapper\IniGetWrapper;
|
||||
use OC\CapabilitiesManager;
|
||||
use OC\Share\Share;
|
||||
use OCP\App\AppPathNotFoundException;
|
||||
use OCP\App\IAppManager;
|
||||
use OCP\Constants;
|
||||
use OCP\Defaults;
|
||||
|
|
@ -115,10 +116,13 @@ class JSConfigHelper {
|
|||
}
|
||||
|
||||
foreach ($apps as $app) {
|
||||
$apps_paths[$app] = $this->appManager->getAppWebPath($app);
|
||||
try {
|
||||
$apps_paths[$app] = $this->appManager->getAppWebPath($app);
|
||||
} catch (AppPathNotFoundException $e) {
|
||||
$apps_paths[$app] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no');
|
||||
$enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes';
|
||||
$defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
|
||||
|
|
|
|||
|
|
@ -66,25 +66,20 @@ class RateLimitingMiddlewareTest extends TestCase {
|
|||
|
||||
public function testBeforeControllerWithoutAnnotation() {
|
||||
$this->reflector
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(4))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'limit')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(1))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'period')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(2))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'limit')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(3))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'period')
|
||||
->willReturn('');
|
||||
->withConsecutive(
|
||||
['AnonRateThrottle', 'limit'],
|
||||
['AnonRateThrottle', 'period'],
|
||||
['UserRateThrottle', 'limit'],
|
||||
['UserRateThrottle', 'period']
|
||||
)
|
||||
->willReturnMap([
|
||||
['AnonRateThrottle', 'limit', ''],
|
||||
['AnonRateThrottle', 'period', ''],
|
||||
['UserRateThrottle', 'limit', ''],
|
||||
['UserRateThrottle', 'period', ''],
|
||||
]);
|
||||
|
||||
$this->limiter
|
||||
->expects($this->never())
|
||||
|
|
@ -107,25 +102,20 @@ class RateLimitingMiddlewareTest extends TestCase {
|
|||
->willReturn('127.0.0.1');
|
||||
|
||||
$this->reflector
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(4))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'limit')
|
||||
->willReturn('100');
|
||||
$this->reflector
|
||||
->expects($this->at(1))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'period')
|
||||
->willReturn('10');
|
||||
$this->reflector
|
||||
->expects($this->at(2))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'limit')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(3))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'period')
|
||||
->willReturn('');
|
||||
->withConsecutive(
|
||||
['AnonRateThrottle', 'limit'],
|
||||
['AnonRateThrottle', 'period'],
|
||||
['UserRateThrottle', 'limit'],
|
||||
['UserRateThrottle', 'period']
|
||||
)
|
||||
->willReturnMap([
|
||||
['AnonRateThrottle', 'limit', '100'],
|
||||
['AnonRateThrottle', 'period', '10'],
|
||||
['UserRateThrottle', 'limit', ''],
|
||||
['UserRateThrottle', 'period', ''],
|
||||
]);
|
||||
|
||||
$this->limiter
|
||||
->expects($this->never())
|
||||
|
|
@ -155,25 +145,20 @@ class RateLimitingMiddlewareTest extends TestCase {
|
|||
->willReturn($user);
|
||||
|
||||
$this->reflector
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(4))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'limit')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(1))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'period')
|
||||
->willReturn('');
|
||||
$this->reflector
|
||||
->expects($this->at(2))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'limit')
|
||||
->willReturn('100');
|
||||
$this->reflector
|
||||
->expects($this->at(3))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'period')
|
||||
->willReturn('10');
|
||||
->withConsecutive(
|
||||
['AnonRateThrottle', 'limit'],
|
||||
['AnonRateThrottle', 'period'],
|
||||
['UserRateThrottle', 'limit'],
|
||||
['UserRateThrottle', 'period']
|
||||
)
|
||||
->willReturnMap([
|
||||
['AnonRateThrottle', 'limit', ''],
|
||||
['AnonRateThrottle', 'period', ''],
|
||||
['UserRateThrottle', 'limit', '100'],
|
||||
['UserRateThrottle', 'period', '10'],
|
||||
]);
|
||||
|
||||
$this->limiter
|
||||
->expects($this->never())
|
||||
|
|
@ -201,25 +186,20 @@ class RateLimitingMiddlewareTest extends TestCase {
|
|||
->willReturn(false);
|
||||
|
||||
$this->reflector
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(4))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'limit')
|
||||
->willReturn('200');
|
||||
$this->reflector
|
||||
->expects($this->at(1))
|
||||
->method('getAnnotationParameter')
|
||||
->with('AnonRateThrottle', 'period')
|
||||
->willReturn('20');
|
||||
$this->reflector
|
||||
->expects($this->at(2))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'limit')
|
||||
->willReturn('100');
|
||||
$this->reflector
|
||||
->expects($this->at(3))
|
||||
->method('getAnnotationParameter')
|
||||
->with('UserRateThrottle', 'period')
|
||||
->willReturn('10');
|
||||
->withConsecutive(
|
||||
['AnonRateThrottle', 'limit'],
|
||||
['AnonRateThrottle', 'period'],
|
||||
['UserRateThrottle', 'limit'],
|
||||
['UserRateThrottle', 'period']
|
||||
)
|
||||
->willReturnMap([
|
||||
['AnonRateThrottle', 'limit', '200'],
|
||||
['AnonRateThrottle', 'period', '20'],
|
||||
['UserRateThrottle', 'limit', '100'],
|
||||
['UserRateThrottle', 'period', '10'],
|
||||
]);
|
||||
|
||||
$this->limiter
|
||||
->expects($this->never())
|
||||
|
|
|
|||
Loading…
Reference in a new issue