Replace resource ID special characters to fix path expansion issue
This commit is contained in:
Tony Tam
2017-01-04 16:17:49 -08:00
committed by GitHub

View File

@@ -111,7 +111,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
addResource: function(resource, auths){ addResource: function(resource, auths){
// Render a resource and add it to resources li // Render a resource and add it to resources li
resource.id = resource.id.replace(/[[\]{}()*+?,\\/^$|#\s]/g, '_'); resource.id = resource.id.replace(/[^a-zA-Z\d]/g, function(str) { return str.charCodeAt(0); });
// Make all definitions available at the root of the resource so that they can // Make all definitions available at the root of the resource so that they can
// be loaded by the JSonEditor // be loaded by the JSonEditor