mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-15 18:05:50 +01:00
Escape in JavaScript
This commit is contained in:
@@ -537,10 +537,6 @@ object RepositoryService {
|
|||||||
|
|
||||||
(id, path.substring(id.length).stripPrefix("/"))
|
(id, path.substring(id.length).stripPrefix("/"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// def getReleaseByTag(tag: String)(implicit s: Session): Option[Release] = {
|
|
||||||
// Releases filter (_.byTag(owner, name, tag)) firstOption
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ $(function(){
|
|||||||
success: function(file, id) {
|
success: function(file, id) {
|
||||||
var attach =
|
var attach =
|
||||||
'<li><a href="@context.baseUrl/@repository.owner/@repository.name/_release/@helpers.encodeRefName(tag)/' + id + '">' +
|
'<li><a href="@context.baseUrl/@repository.owner/@repository.name/_release/@helpers.encodeRefName(tag)/' + id + '">' +
|
||||||
'<i class="octicon octicon-file"></i>' + file.name + '</a>' +
|
'<i class="octicon octicon-file"></i>' + escapeHtml(file.name) + '</a>' +
|
||||||
'<a href="#" class="remove pull-right" style="padding-top: 0px;">(remove)</a>' +
|
'<a href="#" class="remove pull-right" style="padding-top: 0px;">(remove)</a>' +
|
||||||
'<input type="hidden" name="file:' + id + '" value="' + file.name + '"/>' + // TODO escape file.name
|
'<input type="hidden" name="file:' + id + '" value="' + escapeHtml(file.name) + '"/>'
|
||||||
'</li>';
|
'</li>';
|
||||||
$('#assets-list').append(attach);
|
$('#assets-list').append(attach);
|
||||||
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
||||||
|
|||||||
@@ -351,12 +351,12 @@ function scrollIntoView(target){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///**
|
/**
|
||||||
// * escape html
|
* escape html
|
||||||
// */
|
*/
|
||||||
//function escapeHtml(text){
|
function escapeHtml(text){
|
||||||
// return text.replace(/&/g,'&').replace(/</g,'<').replace(/"/g,'"').replace(/>/g,'>');
|
return text.replace(/&/g,'&').replace(/</g,'<').replace(/"/g,'"').replace(/>/g,'>');
|
||||||
//}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* calculate string ranking for path.
|
* calculate string ranking for path.
|
||||||
|
|||||||
Reference in New Issue
Block a user