Skip to content

Commit

Permalink
nitpick
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Jan 19, 2024
1 parent dfa2855 commit 4b3dbb4
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tests/Assets/AssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ public function it_can_upload_an_image_into_a_container_with_new_extension_forma
}

/** @test */
public function it_can_upload_an_svg_with_inline_scripts()
public function it_sanitizes_svgs_on_upload()
{
Event::fake();

Expand All @@ -1742,14 +1742,8 @@ public function it_can_upload_an_svg_with_inline_scripts()
$return = $asset->upload(UploadedFile::fake()->createWithContent('asset.svg', '<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"><script type="text/javascript">alert(`Bad stuff could go in here.`);</script></svg>'));

$this->assertEquals($asset, $return);
$this->assertDirectoryExists($glideDir = storage_path('statamic/glide/tmp'));
$this->assertEmpty(app('files')->allFiles($glideDir)); // no temp files
Storage::disk('test')->assertExists('path/to/asset.svg');
$this->assertEquals('path/to/asset.svg', $asset->path());
Event::assertDispatched(AssetUploaded::class, function ($event) use ($asset) {
return $event->asset = $asset;
});
Event::assertDispatched(AssetSaved::class);

// Ensure the inline scripts were stripped out.
$this->assertStringNotContainsString('<script', $asset->contents());
Expand Down

0 comments on commit 4b3dbb4

Please sign in to comment.