~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/common/util.js

  • Committer: mattgiuca
  • Date: 2008-01-14 05:22:27 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:224
util.js: Removed urlencoding support from "encoded_app_path" (now called
        "app_path"). This was causing double-encoding, as all URLs are already
        encoded by dom_make_link_elem.
    Now encoding is done exactly once, URLs are correct.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
    if (href == null) href = "";
78
78
    var elem = document.createElement(tagname);
79
79
    var link = document.createElement("a");
80
 
    link.setAttribute("href", encodeURI(href));
 
80
    link.setAttribute("href", urlencode_path(href));
81
81
    if (title != null)
82
82
        link.setAttribute("title", title);
83
83
    if (onclick != null)
467
467
    return path_join(root_dir, path);
468
468
}
469
469
 
470
 
/** Shorthand for urlencode_path(make_path(path_join(app, ...)))
471
 
 * Creates a URL-encoded path for a given path within a given app.
 
470
/** Shorthand for make_path(path_join(app, ...))
 
471
 * Creates an absolute path for a given path within a given app.
472
472
 */
473
 
function encoded_app_path(app /*,...*/)
 
473
function app_path(app /*,...*/)
474
474
{
475
 
    return urlencode_path(make_path(path_join.apply(null, arguments)));
 
475
    return make_path(path_join.apply(null, arguments));
476
476
}
477
477
 
478
478
/** Given a path, gets the "basename" (the last path segment).
519
519
{
520
520
    if (content_type != "multipart/form-data")
521
521
        content_type = "application/x-www-form-urlencoded";
522
 
    path = encoded_app_path(app, path);
 
522
    path = urlencode_path(app_path(app, path));
523
523
    var url;
524
524
    /* A random string, for multipart/form-data
525
525
     * (This is not checked against anywhere else, it is solely defined and