mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-08 02:23:44 +00:00
encode path for using in URI
This commit is contained in:
parent
dd5128cb57
commit
9d6dfdabeb
@ -156,7 +156,7 @@
|
|||||||
<% } else { %>
|
<% } else { %>
|
||||||
<a href="#<%= category %>/lib/<%= repo_id %>/" class="path-link normal"><%- repo_name %></a> /
|
<a href="#<%= category %>/lib/<%= repo_id %>/" class="path-link normal"><%- repo_name %></a> /
|
||||||
<% for (var i = 0,len = path_list.length - 1; i < len; i++) { %>
|
<% for (var i = 0,len = path_list.length - 1; i < len; i++) { %>
|
||||||
<a href="#<%= category %>/lib/<%= repo_id %>/<% print(path_list.slice(0, i+1).join('/')); %>" class="path-link normal"><%- path_list[i] %></a> /
|
<a href="#<%= category %>/lib/<%= repo_id %>/<% print(path_list_encoded.slice(0, i+1).join('/')); %>" class="path-link normal"><%- path_list[i] %></a> /
|
||||||
<% } %>
|
<% } %>
|
||||||
<%- path_list[i] + ' /' %>
|
<%- path_list[i] + ' /' %>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -170,9 +170,9 @@
|
|||||||
<td class="dirent-icon"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon" %}" /></td>
|
<td class="dirent-icon"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon" %}" /></td>
|
||||||
<td>
|
<td>
|
||||||
<% if (category) { %>
|
<% if (category) { %>
|
||||||
<span class="dirent-name"><a href="#<%= category %>/lib/<%= repo_id %><%- dirent_path %>" class="dir-link normal"><%- dirent.obj_name %></a></span>
|
<span class="dirent-name"><a href="#<%= category %>/lib/<%= repo_id %><%- encoded_path %>" class="dir-link normal"><%- dirent.obj_name %></a></span>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<span class="dirent-name"><a href="#lib/<%= repo_id %><%- dirent_path %>" class="dir-link normal"><%- dirent.obj_name %></a></span>
|
<span class="dirent-name"><a href="#lib/<%= repo_id %><%- encoded_path %>" class="dir-link normal"><%- dirent.obj_name %></a></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</td>
|
</td>
|
||||||
<td class="dirent-op">
|
<td class="dirent-op">
|
||||||
|
@ -216,10 +216,13 @@ define([
|
|||||||
category: dir.category
|
category: dir.category
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var path_list = path.substr(1).split('/');
|
||||||
|
var path_list_encoded = path_list.map(function(e) { return encodeURIComponent(e); });
|
||||||
if (path != '/') {
|
if (path != '/') {
|
||||||
$.extend(obj, {
|
$.extend(obj, {
|
||||||
path_list: path.substr(1).split('/'),
|
path_list: path_list,
|
||||||
repo_id: dir.repo_id,
|
path_list_encoded: path_list_encoded,
|
||||||
|
repo_id: dir.repo_id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,9 +29,11 @@ define([
|
|||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var dir = this.dir;
|
var dir = this.dir;
|
||||||
|
var dirent_path = Common.pathJoin([dir.path, this.model.get('obj_name')]);
|
||||||
this.$el.html(this.template({
|
this.$el.html(this.template({
|
||||||
dirent: this.model.attributes,
|
dirent: this.model.attributes,
|
||||||
dirent_path: Common.pathJoin([dir.path, this.model.get('obj_name')]),
|
dirent_path: dirent_path,
|
||||||
|
encoded_path: Common.encodePath(dirent_path),
|
||||||
category: dir.category,
|
category: dir.category,
|
||||||
repo_id: dir.repo_id,
|
repo_id: dir.repo_id,
|
||||||
user_perm: dir.user_perm,
|
user_perm: dir.user_perm,
|
||||||
|
@ -296,6 +296,12 @@ define([
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
encodePath: function(path) {
|
||||||
|
return path.split('/').map(function(e) {
|
||||||
|
return encodeURIComponent(e);
|
||||||
|
}).join('/');
|
||||||
|
},
|
||||||
|
|
||||||
closePopup: function(e, popup, popup_switch) {
|
closePopup: function(e, popup, popup_switch) {
|
||||||
var target = e.target || event.srcElement;
|
var target = e.target || event.srcElement;
|
||||||
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
|
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user