Skip to content

Commit

Permalink
Revert "Use proper named File when uploading external images (WordP…
Browse files Browse the repository at this point in the history
…ress#65693)"

This reverts commit 0301198.
  • Loading branch information
huubl authored Oct 2, 2024
1 parent 18c79ae commit 7e4bd87
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { moreVertical, external } from '@wordpress/icons';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
import { isBlobURL } from '@wordpress/blob';
import { getFilename } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -168,13 +167,8 @@ export function MediaPreview( { media, onClick, category } ) {
.fetch( url )
.then( ( response ) => response.blob() )
.then( ( blob ) => {
const fileName = getFilename( url ) || 'image.jpg';
const file = new File( [ blob ], fileName, {
type: blob.type,
} );

settings.mediaUpload( {
filesList: [ file ],
filesList: [ blob ],
additionalData: { caption },
onFileChange( [ img ] ) {
if ( isBlobURL( img.url ) ) {
Expand Down

0 comments on commit 7e4bd87

Please sign in to comment.