File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ protected function getNewExtension()
7171 return null ;
7272 }
7373
74+ if ($ ext === 'pjpg ' ) {
75+ $ ext = 'jpg ' ;
76+ }
77+
7478 return $ ext ;
7579 }
7680
Original file line number Diff line number Diff line change @@ -1912,6 +1912,36 @@ public function it_can_upload_an_image_into_a_container_with_new_extension_forma
19121912 Event::assertDispatched (AssetSaved::class);
19131913 }
19141914
1915+ #[Test]
1916+ public function it_normalizes_pjpg_format_to_jpg_extension_on_upload ()
1917+ {
1918+ Event::fake ();
1919+
1920+ config (['statamic.assets.image_manipulation.presets.progressive ' => [
1921+ 'fm ' => 'pjpg ' ,
1922+ ]]);
1923+
1924+ $ this ->container ->sourcePreset ('progressive ' );
1925+
1926+ $ asset = (new Asset )->container ($ this ->container )->path ('path/to/asset.jpg ' )->syncOriginal ();
1927+
1928+ Facades \AssetContainer::shouldReceive ('findByHandle ' )->with ('test_container ' )->andReturn ($ this ->container );
1929+ Storage::disk ('test ' )->assertMissing ('path/to/asset.jpg ' );
1930+
1931+ ImageValidator::partialMock ()
1932+ ->shouldReceive ('isValidImage ' )
1933+ ->with ('jpg ' , 'image/jpeg ' )
1934+ ->andReturnTrue ()
1935+ ->once ();
1936+
1937+ $ return = $ asset ->upload (UploadedFile::fake ()->image ('asset.jpg ' , 20 , 30 ));
1938+
1939+ $ this ->assertEquals ($ asset , $ return );
1940+ Storage::disk ('test ' )->assertMissing ('path/to/asset.pjpg ' );
1941+ Storage::disk ('test ' )->assertExists ('path/to/asset.jpg ' );
1942+ $ this ->assertEquals ('path/to/asset.jpg ' , $ asset ->path ());
1943+ }
1944+
19151945 #[Test]
19161946 public function it_sanitizes_svgs_on_upload ()
19171947 {
You can’t perform that action at this time.
0 commit comments