In media.model.PostMedia, for these 2 scenarios:

* `src` is set, and 'Add a Source' results in the same file (or a file with the same extension) being added
* `src` is set, and 'Replace Audio|Video' is used, which will add a model property named by the attachment's extension

... call `model.unset( 'src' )`.

See #27389.



git-svn-id: https://develop.svn.wordpress.org/trunk@27536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-03-14 12:59:28 +00:00
parent 12792afdde
commit 5e1e5c53ec

View File

@ -467,6 +467,10 @@ window.wp = window.wp || {};
this.attachment = attachment;
this.extension = attachment.get('filename' ).split('.').pop();
if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
this.unset( 'src' );
}
if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
this.set( this.extension, this.attachment.get( 'url' ) );
} else {
@ -479,6 +483,7 @@ window.wp = window.wp || {};
this.setSource( attachment );
this.unset( 'src' );
_.each( _.without( wp.media.view.settings.embedExts, this.extension ), function (ext) {
self.unset( ext );
} );