Changeset 4927 for branches/2.11-stable
- Timestamp:
- May 13, 2009, 11:22:41 AM (14 years ago)
- Location:
- branches/2.11-stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.11-stable/src/core/net/sf/basedb/core/Path.java
r4517 r4927 23 23 package net.sf.basedb.core; 24 24 25 import java.io.UnsupportedEncodingException; 26 import java.net.URLEncoder; 25 27 import java.util.regex.Pattern; 26 28 … … 283 285 return sb.toString(); 284 286 } 287 288 /** 289 Get this Path's URL-string encoded with a given 290 character encoding. 291 292 @param enc The encoding to use. UTF-8 is used is this is null. 293 @return The encoded URL-string. 294 @throws UnsupportedEncodingException If the give encoding is not supported 295 @since 2.11.1 296 */ 297 public String toURLString(String enc) 298 throws UnsupportedEncodingException 299 { 300 StringBuilder sb = new StringBuilder(); 301 enc = (enc == null || enc.length() == 0) ? "UTF-8" : enc; 302 if (userlogin != null) 303 { 304 sb.append("~").append(URLEncoder.encode(userlogin, enc)); 305 } 306 for (String directory : directories) 307 { 308 sb.append("/").append(URLEncoder.encode(directory, enc)); 309 } 310 if (filename != null && getType() == Type.FILE) 311 { 312 sb.append("/").append(URLEncoder.encode(filename, enc)); 313 } 314 if (sb.length() == 0) sb.append("/"); // For the root directory 315 return sb.toString(); 316 } 285 317 286 318 /** -
branches/2.11-stable/www/filemanager/files/index.jsp
r4587 r4927 465 465 dc = sc.newDbControl(); 466 466 File f = File.getById(dc, cc.getId()); 467 redirect = root + "filemanager/files/view/-"+ID+"-"+ HTML.urlEncode(f.getPath().toString());467 redirect = root + "filemanager/files/view/-"+ID+"-"+ f.getPath().toURLString("UTF-8"); 468 468 dc.close(); 469 469 } -
branches/2.11-stable/www/filemanager/index.jsp
r4510 r4927 89 89 dc = sc.newDbControl(); 90 90 File f = File.getById(dc, cc.getId()); 91 redirect = root + "filemanager/files/view/-"+ID+"-"+ HTML.urlEncode(f.getPath().toString());91 redirect = root + "filemanager/files/view/-"+ID+"-"+ f.getPath().toURLString("UTF-8"); 92 92 dc.close(); 93 93 }
Note: See TracChangeset
for help on using the changeset viewer.