Skip to content
Snippets Groups Projects
Verified Commit cda71813 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3391578 by catch: jsonapi FileUploadTest clears too many caches

parent 34735879
No related branches found
No related tags found
41 merge requests!12227Issue #3181946 by jonmcl, mglaman,!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3478Issue #3337882: Deleted menus are not removed from content type config,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.
Pipeline #27115 canceled
Pipeline: drupal

#27119

    Pipeline: drupal

    #27118

      Pipeline: drupal

      #27117

        +1
        ......@@ -141,8 +141,6 @@ protected function setUp(): void {
        // Reload entity so that it has the new field.
        $this->entity = $this->entityStorage->loadUnchanged($this->entity->id());
        $this->rebuildAll();
        }
        /**
        ......@@ -202,10 +200,19 @@ protected function createEntity() {
        return $entity_test;
        }
        /**
        * {@inheritdoc}
        */
        public function testRelated() {
        \Drupal::service('router.builder')->rebuild();
        parent::testRelated();
        }
        /**
        * Tests using the file upload POST route; needs second request to "use" file.
        */
        public function testPostFileUpload() {
        \Drupal::service('router.builder')->rebuild();
        $uri = Url::fromUri('base:' . static::$postUri);
        // DX: 405 when read-only mode is enabled.
        ......@@ -270,6 +277,7 @@ public function testPostFileUpload() {
        * Tests using the 'file upload and "use" file in single request" POST route.
        */
        public function testPostFileUploadAndUseInSingleRequest() {
        \Drupal::service('router.builder')->rebuild();
        // Update the test entity so it already has a file. This allows verifying
        // that this route appends files, and does not replace them.
        mkdir('public://foobar');
        ......@@ -420,6 +428,7 @@ protected function testPostFileUploadInvalidHeaders() {
        * A new file should be created with a suffixed name.
        */
        public function testPostFileUploadDuplicateFile() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        ......@@ -460,6 +469,7 @@ public function testPostFileUploadDuplicateFile() {
        * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Directives
        */
        public function testFileUploadStrippedFilePath() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        ......@@ -488,7 +498,7 @@ public function testFileUploadStrippedFilePath() {
        // with no extension to pass validation.
        $this->field->setSetting('file_extensions', '')
        ->save();
        $this->rebuildAll();
        \Drupal::service('router.builder')->rebuild();
        $response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'file; filename="/etc/passwd"']);
        $this->assertSame(201, $response->getStatusCode());
        ......@@ -506,6 +516,7 @@ public function testFileUploadStrippedFilePath() {
        * Tests invalid file uploads.
        */
        public function testInvalidFileUploads() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        $this->testPostFileUploadInvalidHeaders();
        ......@@ -517,6 +528,7 @@ public function testInvalidFileUploads() {
        * Tests using the file upload route with a unicode file name.
        */
        public function testFileUploadUnicodeFilename() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        ......@@ -535,6 +547,7 @@ public function testFileUploadUnicodeFilename() {
        * Tests using the file upload route with a zero byte file.
        */
        public function testFileUploadZeroByteFile() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        ......@@ -556,6 +569,7 @@ public function testFileUploadZeroByteFile() {
        * Tests using the file upload route with an invalid file type.
        */
        public function testFileUploadInvalidFileType() {
        \Drupal::service('router.builder')->rebuild();
        $this->setUpAuthorization('POST');
        $this->config('jsonapi.settings')->set('read_only', FALSE)->save(TRUE);
        ......@@ -577,8 +591,7 @@ protected function testFileUploadLargerFileSize() {
        // Set a limit of 50 bytes.
        $this->field->setSetting('max_filesize', 50)
        ->save();
        $this->rebuildAll();
        \Drupal::service('router.builder')->rebuild();
        $uri = Url::fromUri('base:' . static::$postUri);
        // Generate a string larger than the 50 byte limit set.
        ......@@ -694,7 +707,7 @@ protected function testFileUploadMaliciousExtension() {
        ->save();
        // Allow all file uploads. This is very insecure.
        $this->field->setSetting('file_extensions', '')->save();
        $this->rebuildAll();
        \Drupal::service('router.builder')->rebuild();
        $response = $this->fileRequest($uri, $php_string, ['Content-Disposition' => 'filename="example_7.php"']);
        $expected = $this->getExpectedDocument(7, 'example_7.php', TRUE);
        ......@@ -717,7 +730,7 @@ public function testFileUploadNoConfiguration() {
        $this->field->setSetting('file_extensions', '')
        ->save();
        $this->rebuildAll();
        \Drupal::service('router.builder')->rebuild();
        $response = $this->fileRequest($uri, $this->testFileData, ['Content-Disposition' => 'filename="example.txt"']);
        $expected = $this->getExpectedDocument(1, 'example.txt', TRUE);
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment