Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit df8def5

Browse files
author
Gabriel Schulhof
committed
Path: Always uri-decode when computing dataUrl
1 parent 3777393 commit df8def5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/navigation/path.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,21 @@ define([
202202
},
203203

204204
convertUrlToDataUrl: function( absUrl ) {
205-
var u = path.parseUrl( absUrl );
205+
var result = absUrl,
206+
u = path.parseUrl( absUrl );
207+
206208
if ( path.isEmbeddedPage( u ) ) {
207209
// For embedded pages, remove the dialog hash key as in getFilePath(),
208210
// and remove otherwise the Data Url won't match the id of the embedded Page.
209-
return u.hash
211+
result = u.hash
210212
.split( dialogHashKey )[0]
211213
.replace( /^#/, "" )
212214
.replace( /\?.*$/, "" );
213215
} else if ( path.isSameDomain( u, this.documentBase ) ) {
214-
return u.hrefNoHash.replace( this.documentBase.domain, "" ).split( dialogHashKey )[0];
216+
result = u.hrefNoHash.replace( this.documentBase.domain, "" ).split( dialogHashKey )[0];
215217
}
216218

217-
return window.decodeURIComponent(absUrl);
219+
return window.decodeURIComponent( result );
218220
},
219221

220222
//get path from current hash, or from a file path

0 commit comments

Comments
 (0)