mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 16:20:52 +00:00
Prevent exception throwing in getFilename of MWImageNode
This doesn't happen in real life (as resource is always set) but it allows us to contruct these nodes from the factory with no data. Change-Id: Iea146f5dc128ad9d0f36a79b6fe67d622767d46c
This commit is contained in:
parent
8517777b9f
commit
26751dc4a1
|
@ -246,7 +246,7 @@ ve.dm.MWImageNode.prototype.onAttributeChange = function ( key, from, to ) {
|
|||
*/
|
||||
ve.dm.MWImageNode.prototype.getFilename = function () {
|
||||
// Strip ./ stuff and decode URI encoding
|
||||
var resource = this.getAttribute( 'resource' ),
|
||||
var resource = this.getAttribute( 'resource' ) || '',
|
||||
filename = resource.replace( /^(\.+\/)*/, '' );
|
||||
|
||||
// Protect against decodeURIComponent() throwing exceptions
|
||||
|
|
Loading…
Reference in a new issue