mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-04-09 07:25:21 -04:00
Prevent server_add autocomplete from being interpreted as UTF-7. Fixes #1871.
This commit is contained in:
@@ -71,14 +71,13 @@ class Admin_Server_Add_Controller extends Admin_Controller {
|
||||
}
|
||||
|
||||
public function autocomplete() {
|
||||
$directories = array();
|
||||
$directories = array('<meta http-equiv="content-type" content="text/html; charset=utf-8">');
|
||||
$path_prefix = Input::instance()->get("q");
|
||||
foreach (glob("{$path_prefix}*") as $file) {
|
||||
if (is_dir($file) && !is_link($file)) {
|
||||
$directories[] = html::clean($file);
|
||||
}
|
||||
}
|
||||
|
||||
print implode("\n", $directories);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,23 @@ $("document").ready(function() {
|
||||
{
|
||||
max: 256,
|
||||
loadingClass: "g-loading-small",
|
||||
parse: function(data) {
|
||||
var parsed = [];
|
||||
var rows = data.split("\n");
|
||||
rows.shift(); // drop <META> tag
|
||||
for (var i=0; i < rows.length; i++) {
|
||||
var row = $.trim(rows[i]);
|
||||
if (row) {
|
||||
row = row.split("|");
|
||||
parsed[parsed.length] = {
|
||||
data: row,
|
||||
value: row[0],
|
||||
result: row[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user