public static function objectUrl($base, $oname) {
    if (strpos($oname, '/') === FALSE) {
      return $base . '/' . rawurlencode($oname);
    }

    $oParts = explode('/', $oname);
    $buffer = array();
    foreach ($oParts as $part) {
      $buffer[] = rawurlencode($part);
    }
    $newname = implode('/', $buffer);
    return $base . '/' . $newname;
  }