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("/"))
|
||||
}
|
||||
|
||||
// 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"
|
||||
|
||||
@@ -75,9 +75,9 @@ $(function(){
|
||||
success: function(file, id) {
|
||||
var attach =
|
||||
'<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>' +
|
||||
'<input type="hidden" name="file:' + id + '" value="' + file.name + '"/>' + // TODO escape file.name
|
||||
'<input type="hidden" name="file:' + id + '" value="' + escapeHtml(file.name) + '"/>'
|
||||
'</li>';
|
||||
$('#assets-list').append(attach);
|
||||
$(file.previewElement).prevAll('div.dz-preview').addBack().remove();
|
||||
|
||||
@@ -351,12 +351,12 @@ function scrollIntoView(target){
|
||||
}
|
||||
}
|
||||
|
||||
///**
|
||||
// * escape html
|
||||
// */
|
||||
//function escapeHtml(text){
|
||||
// return text.replace(/&/g,'&').replace(/</g,'<').replace(/"/g,'"').replace(/>/g,'>');
|
||||
//}
|
||||
/**
|
||||
* escape html
|
||||
*/
|
||||
function escapeHtml(text){
|
||||
return text.replace(/&/g,'&').replace(/</g,'<').replace(/"/g,'"').replace(/>/g,'>');
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate string ranking for path.
|
||||
|
||||
Reference in New Issue
Block a user