diff --git a/app/Services/IconStoreService.php b/app/Services/IconStoreService.php index 048dc635..520be581 100644 --- a/app/Services/IconStoreService.php +++ b/app/Services/IconStoreService.php @@ -227,7 +227,7 @@ public function store(string $name, string $content) : bool } if ($content != $sanitized) { - $content = $sanitized; + $content = $sanitized; $storedToDisk = $this->storeToDisk($name, $content); } } diff --git a/tests/Api/v1/Controllers/IconControllerTest.php b/tests/Api/v1/Controllers/IconControllerTest.php index b0e1188f..a50ca3d0 100644 --- a/tests/Api/v1/Controllers/IconControllerTest.php +++ b/tests/Api/v1/Controllers/IconControllerTest.php @@ -42,7 +42,7 @@ public function setUp() : void LogoService::TFA_URL => Http::response(HttpRequestTestData::TFA_JSON_BODY, 200), ]); Http::fake([ - OtpTestData::EXTERNAL_IMAGE_URL_DECODED => Http::response((new FileFactory)->image('file.png', 10, 10)->tempFile, 200), + OtpTestData::EXTERNAL_IMAGE_URL_DECODED => Http::response((new FileFactory)->image('file.png', 10, 10)->tempFile, 200), ]); $this->user = User::factory()->create(); diff --git a/tests/Api/v1/Controllers/TwoFAccountControllerTest.php b/tests/Api/v1/Controllers/TwoFAccountControllerTest.php index 39a93edd..4ddbc434 100644 --- a/tests/Api/v1/Controllers/TwoFAccountControllerTest.php +++ b/tests/Api/v1/Controllers/TwoFAccountControllerTest.php @@ -241,11 +241,11 @@ public function setUp() : void Http::preventStrayRequests(); Http::fake([ - LogoService::TFA_IMG_URL . '*' => Http::response(HttpRequestTestData::SVG_LOGO_BODY, 200), - LogoService::TFA_URL => Http::response(HttpRequestTestData::TFA_JSON_BODY, 200), - OtpTestData::EXTERNAL_IMAGE_URL_DECODED => Http::response((new FileFactory)->image('file.png', 10, 10)->tempFile, 200), + LogoService::TFA_IMG_URL . '*' => Http::response(HttpRequestTestData::SVG_LOGO_BODY, 200), + LogoService::TFA_URL => Http::response(HttpRequestTestData::TFA_JSON_BODY, 200), + OtpTestData::EXTERNAL_IMAGE_URL_DECODED => Http::response((new FileFactory)->image('file.png', 10, 10)->tempFile, 200), OtpTestData::EXTERNAL_INFECTED_IMAGE_URL_DECODED => Http::response((new FileFactory)->createWithContent('infected.svg', OtpTestData::ICON_SVG_DATA_INFECTED)->tempFile, 200), - 'example.com/*' => Http::response(null, 400), + 'example.com/*' => Http::response(null, 400), ]); $this->user = User::factory()->create(); diff --git a/tests/Feature/Services/IconStoreServiceTest.php b/tests/Feature/Services/IconStoreServiceTest.php index 7f33abdb..7a062494 100644 --- a/tests/Feature/Services/IconStoreServiceTest.php +++ b/tests/Feature/Services/IconStoreServiceTest.php @@ -495,7 +495,7 @@ public function test_store_returns_false_when_it_fails() public function test_store_stores_sanitized_svg_content() { Settings::set('storeIconsInDatabase', true); - + $result = $this->iconStore->store(OtpTestData::ICON_SVG, OtpTestData::ICON_SVG_DATA_INFECTED); $this->assertTrue($result); @@ -504,9 +504,9 @@ public function test_store_stores_sanitized_svg_content() OtpTestData::ICON_SVG_MALICIOUS_CODE, Storage::disk('icons')->get(OtpTestData::ICON_SVG) ); - + $dbRecord = DB::table('icons')->where('name', OtpTestData::ICON_SVG)->first(); - + $this->assertStringNotContainsString( OtpTestData::ICON_SVG_MALICIOUS_CODE, $dbRecord->content, @@ -525,7 +525,7 @@ public function test_store_returns_false_when_svg_sanitize_failed() public function test_store_deletes_svg_icon_that_cannot_be_sanitized() { Settings::set('storeIconsInDatabase', true); - + $result = $this->iconStore->store(OtpTestData::ICON_SVG, 'this_will_make_svg_data_invalid' . OtpTestData::ICON_SVG_DATA); Storage::disk('icons')->assertMissing(OtpTestData::ICON_SVG);