File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ var URIPrototype = function(uri_prop_name)
2222 short_distinguisher // the last part of a url that can be used to distinguish it
2323 */
2424
25+ var DATA_URI_LENGTH_SHORT = 25 ;
26+
2527 [
2628 "hash" ,
2729 "host" ,
@@ -132,7 +134,12 @@ var URIPrototype = function(uri_prop_name)
132134 if ( this . _short_url === undefined && ( this . _is_parsed || this [ uri_prop_name ] ) )
133135 {
134136 if ( this . _is_data_uri )
135- this . _short_url = ( this . _protocol + this . _pathname ) . slice ( 0 , 20 ) + "…" ;
137+ {
138+ var short_url = this . _protocol + this . _pathname ;
139+ this . _short_url = short_url . length <= DATA_URI_LENGTH_SHORT
140+ ? short_url
141+ : short_url . slice ( 0 , DATA_URI_LENGTH_SHORT ) + "…" ;
142+ }
136143 else
137144 this . _short_url = this . filename || this . basename || this . host ;
138145 }
Original file line number Diff line number Diff line change 149149 equal ( uri . abs_dir , "" ) ;
150150 equal ( uri . basename , "" ) ;
151151 equal ( uri . filename , "" ) ;
152- equal ( uri . short_url , "data:text/plain,a… " ) ;
152+ equal ( uri . short_url , "data:text/plain,a" ) ;
153153
154154 var uri = new URI ( "data:text/plain,abcdefghijklmnopqrstuvwxyz" ) ;
155155 equal ( uri . protocol , "data:" ) ;
159159 equal ( uri . abs_dir , "" ) ;
160160 equal ( uri . basename , "" ) ;
161161 equal ( uri . filename , "" ) ;
162- equal ( uri . short_url , "data:text/plain,abcd …" ) ;
162+ equal ( uri . short_url , "data:text/plain,abcdefghi …" ) ;
163163
164164} ) ;
165165
You can’t perform that action at this time.
0 commit comments