Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ihor Kaharlichenko
swagger-ui-oms
Commits
fc0ccd44
Commit
fc0ccd44
authored
Dec 20, 2013
by
Bryan Matsuo
Browse files
restrict uploaded file inputs to those in the form being submitted
parent
7f68c357
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
dist/index.html
View file @
fc0ccd44
...
...
@@ -5,7 +5,7 @@
<link
href=
'//fonts.googleapis.com/css?family=Droid+Sans:400,700'
rel=
'stylesheet'
type=
'text/css'
/>
<link
href=
'css/highlight.default.css'
media=
'screen'
rel=
'stylesheet'
type=
'text/css'
/>
<link
href=
'css/screen.css'
media=
'screen'
rel=
'stylesheet'
type=
'text/css'
/>
<script
type=
"text/javascript"
src=
"lib/shred.bundle.js"
/
></script>
<script
type=
"text/javascript"
src=
"lib/shred.bundle.js"
></script>
<script
src=
'lib/jquery-1.8.0.min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/jquery.slideto.min.js'
type=
'text/javascript'
></script>
<script
src=
'lib/jquery.wiggle.min.js'
type=
'text/javascript'
></script>
...
...
dist/swagger-ui.js
View file @
fc0ccd44
...
...
@@ -1182,18 +1182,18 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
// Generated by CoffeeScript 1.
6.3
// Generated by CoffeeScript 1.
5.0
(
function
()
{
var
ContentTypeView
,
HeaderView
,
MainView
,
OperationView
,
ParameterContentTypeView
,
ParameterView
,
ResourceView
,
ResponseContentTypeView
,
SignatureView
,
StatusCodeView
,
SwaggerUi
,
_ref
,
_ref1
,
_ref10
,
_ref2
,
_ref3
,
_ref4
,
_ref5
,
_ref6
,
_ref7
,
_ref8
,
_ref9
,
var
ContentTypeView
,
HeaderView
,
MainView
,
OperationView
,
ParameterContentTypeView
,
ParameterView
,
ResourceView
,
ResponseContentTypeView
,
SignatureView
,
StatusCodeView
,
SwaggerUi
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
SwaggerUi
=
(
function
(
_super
)
{
__extends
(
SwaggerUi
,
_super
);
function
SwaggerUi
()
{
_ref
=
SwaggerUi
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref
;
SwaggerUi
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
SwaggerUi
.
prototype
.
dom_id
=
"
swagger_ui
"
;
...
...
@@ -1242,9 +1242,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
SwaggerUi
.
prototype
.
load
=
function
()
{
var
url
,
_ref
1
;
if
((
_ref
1
=
this
.
mainView
)
!=
null
)
{
_ref
1
.
clear
();
var
url
,
_ref
;
if
((
_ref
=
this
.
mainView
)
!=
null
)
{
_ref
.
clear
();
}
url
=
this
.
options
.
url
;
if
(
url
.
indexOf
(
"
http
"
)
!==
0
)
{
...
...
@@ -1322,11 +1322,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
window
.
SwaggerUi
=
SwaggerUi
;
HeaderView
=
(
function
(
_super
)
{
__extends
(
HeaderView
,
_super
);
function
HeaderView
()
{
_ref1
=
HeaderView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref1
;
HeaderView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
HeaderView
.
prototype
.
events
=
{
...
...
@@ -1384,21 +1384,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
MainView
=
(
function
(
_super
)
{
__extends
(
MainView
,
_super
);
function
MainView
()
{
_ref2
=
MainView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref2
;
MainView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
MainView
.
prototype
.
initialize
=
function
()
{};
MainView
.
prototype
.
render
=
function
()
{
var
resource
,
_i
,
_len
,
_ref
3
;
var
resource
,
_i
,
_len
,
_ref
;
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
main
(
this
.
model
));
_ref
3
=
this
.
model
.
apisArray
;
for
(
_i
=
0
,
_len
=
_ref
3
.
length
;
_i
<
_len
;
_i
++
)
{
resource
=
_ref
3
[
_i
];
_ref
=
this
.
model
.
apisArray
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
resource
=
_ref
[
_i
];
this
.
addResource
(
resource
);
}
return
this
;
...
...
@@ -1424,23 +1424,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
ResourceView
=
(
function
(
_super
)
{
__extends
(
ResourceView
,
_super
);
function
ResourceView
()
{
_ref3
=
ResourceView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref3
;
ResourceView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
ResourceView
.
prototype
.
initialize
=
function
()
{};
ResourceView
.
prototype
.
render
=
function
()
{
var
operation
,
_i
,
_len
,
_ref
4
;
var
operation
,
_i
,
_len
,
_ref
;
console
.
log
(
this
.
model
.
description
);
$
(
this
.
el
).
html
(
Handlebars
.
templates
.
resource
(
this
.
model
));
this
.
number
=
0
;
_ref
4
=
this
.
model
.
operationsArray
;
for
(
_i
=
0
,
_len
=
_ref
4
.
length
;
_i
<
_len
;
_i
++
)
{
operation
=
_ref
4
[
_i
];
_ref
=
this
.
model
.
operationsArray
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
operation
=
_ref
[
_i
];
this
.
addOperation
(
operation
);
}
return
this
;
...
...
@@ -1463,11 +1463,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
OperationView
=
(
function
(
_super
)
{
__extends
(
OperationView
,
_super
);
function
OperationView
()
{
_ref4
=
OperationView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref4
;
OperationView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
OperationView
.
prototype
.
invocationUrl
=
null
;
...
...
@@ -1482,7 +1482,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
OperationView
.
prototype
.
initialize
=
function
()
{};
OperationView
.
prototype
.
render
=
function
()
{
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
type
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
5
,
_ref
6
,
_ref
7
;
var
contentTypeModel
,
isMethodSubmissionSupported
,
param
,
responseContentTypeView
,
responseSignatureView
,
signatureModel
,
statusCode
,
type
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref
1
,
_ref
2
;
isMethodSubmissionSupported
=
true
;
if
(
!
isMethodSubmissionSupported
)
{
this
.
model
.
isReadOnly
=
true
;
...
...
@@ -1507,9 +1507,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
contentTypeModel
.
consumes
=
this
.
model
.
consumes
;
contentTypeModel
.
produces
=
this
.
model
.
produces
;
_ref
5
=
this
.
model
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref
5
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
5
[
_i
];
_ref
=
this
.
model
.
parameters
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
param
=
_ref
[
_i
];
type
=
param
.
type
||
param
.
dataType
;
if
(
type
.
toLowerCase
()
===
'
file
'
)
{
if
(
!
contentTypeModel
.
consumes
)
{
...
...
@@ -1522,14 +1522,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
model
:
contentTypeModel
});
$
(
'
.response-content-type
'
,
$
(
this
.
el
)).
append
(
responseContentTypeView
.
render
().
el
);
_ref
6
=
this
.
model
.
parameters
;
for
(
_j
=
0
,
_len1
=
_ref
6
.
length
;
_j
<
_len1
;
_j
++
)
{
param
=
_ref
6
[
_j
];
_ref
1
=
this
.
model
.
parameters
;
for
(
_j
=
0
,
_len1
=
_ref
1
.
length
;
_j
<
_len1
;
_j
++
)
{
param
=
_ref
1
[
_j
];
this
.
addParameter
(
param
,
contentTypeModel
.
consumes
);
}
_ref
7
=
this
.
model
.
responseMessages
;
for
(
_k
=
0
,
_len2
=
_ref
7
.
length
;
_k
<
_len2
;
_k
++
)
{
statusCode
=
_ref
7
[
_k
];
_ref
2
=
this
.
model
.
responseMessages
;
for
(
_k
=
0
,
_len2
=
_ref
2
.
length
;
_k
<
_len2
;
_k
++
)
{
statusCode
=
_ref
2
[
_k
];
this
.
addStatusCode
(
statusCode
);
}
return
this
;
...
...
@@ -1556,7 +1556,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView
.
prototype
.
submitOperation
=
function
(
e
)
{
var
error_free
,
form
,
isFileUpload
,
map
,
o
,
opts
,
val
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
5
,
_ref
6
,
_ref
7
;
var
error_free
,
form
,
isFileUpload
,
map
,
o
,
opts
,
val
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
,
_ref
1
,
_ref
2
;
if
(
e
!=
null
)
{
e
.
preventDefault
();
}
...
...
@@ -1581,9 +1581,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
parent
:
this
};
isFileUpload
=
false
;
_ref
5
=
form
.
find
(
"
input
"
);
for
(
_i
=
0
,
_len
=
_ref
5
.
length
;
_i
<
_len
;
_i
++
)
{
o
=
_ref
5
[
_i
];
_ref
=
form
.
find
(
"
input
"
);
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
o
=
_ref
[
_i
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
o
.
name
]
=
o
.
value
;
}
...
...
@@ -1591,16 +1591,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
isFileUpload
=
true
;
}
}
_ref
6
=
form
.
find
(
"
textarea
"
);
for
(
_j
=
0
,
_len1
=
_ref
6
.
length
;
_j
<
_len1
;
_j
++
)
{
o
=
_ref
6
[
_j
];
_ref
1
=
form
.
find
(
"
textarea
"
);
for
(
_j
=
0
,
_len1
=
_ref
1
.
length
;
_j
<
_len1
;
_j
++
)
{
o
=
_ref
1
[
_j
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
"
body
"
]
=
o
.
value
;
}
}
_ref
7
=
form
.
find
(
"
select
"
);
for
(
_k
=
0
,
_len2
=
_ref
7
.
length
;
_k
<
_len2
;
_k
++
)
{
o
=
_ref
7
[
_k
];
_ref
2
=
form
.
find
(
"
select
"
);
for
(
_k
=
0
,
_len2
=
_ref
2
.
length
;
_k
<
_len2
;
_k
++
)
{
o
=
_ref
2
[
_k
];
val
=
this
.
getSelectedValue
(
o
);
if
((
val
!=
null
)
&&
jQuery
.
trim
(
val
).
length
>
0
)
{
map
[
o
.
name
]
=
val
;
...
...
@@ -1622,36 +1622,38 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView
.
prototype
.
handleFileUpload
=
function
(
map
,
form
)
{
var
bodyParam
,
headerParams
,
o
,
obj
,
param
,
_i
,
_j
,
_k
,
_len
,
_len1
,
_len2
,
_ref
5
,
_ref
6
,
_ref
7
,
var
bodyParam
,
el
,
headerParams
,
o
,
obj
,
param
,
_i
,
_j
,
_k
,
_l
,
_len
,
_len1
,
_len2
,
_len3
,
_ref
,
_ref
1
,
_ref
2
,
_ref
3
,
_this
=
this
;
console
.
log
(
"
it's a file upload
"
);
_ref
5
=
form
.
serializeArray
();
for
(
_i
=
0
,
_len
=
_ref
5
.
length
;
_i
<
_len
;
_i
++
)
{
o
=
_ref
5
[
_i
];
_ref
=
form
.
serializeArray
();
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
o
=
_ref
[
_i
];
if
((
o
.
value
!=
null
)
&&
jQuery
.
trim
(
o
.
value
).
length
>
0
)
{
map
[
o
.
name
]
=
o
.
value
;
}
}
bodyParam
=
new
FormData
();
_ref
6
=
this
.
model
.
parameters
;
for
(
_j
=
0
,
_len1
=
_ref
6
.
length
;
_j
<
_len1
;
_j
++
)
{
param
=
_ref
6
[
_j
];
_ref
1
=
this
.
model
.
parameters
;
for
(
_j
=
0
,
_len1
=
_ref
1
.
length
;
_j
<
_len1
;
_j
++
)
{
param
=
_ref
1
[
_j
];
if
(
param
.
paramType
===
'
form
'
)
{
bodyParam
.
append
(
param
.
name
,
map
[
param
.
name
]);
}
}
headerParams
=
{};
_ref
7
=
this
.
model
.
parameters
;
for
(
_k
=
0
,
_len2
=
_ref
7
.
length
;
_k
<
_len2
;
_k
++
)
{
param
=
_ref
7
[
_k
];
_ref
2
=
this
.
model
.
parameters
;
for
(
_k
=
0
,
_len2
=
_ref
2
.
length
;
_k
<
_len2
;
_k
++
)
{
param
=
_ref
2
[
_k
];
if
(
param
.
paramType
===
'
header
'
)
{
headerParams
[
param
.
name
]
=
map
[
param
.
name
];
}
}
console
.
log
(
headerParams
);
$
.
each
(
$
(
'
input[type~="file"]
'
),
function
(
i
,
el
)
{
return
bodyParam
.
append
(
$
(
el
).
attr
(
'
name
'
),
el
.
files
[
0
]);
});
_ref3
=
form
.
find
(
'
input[type~="file"]
'
);
for
(
_l
=
0
,
_len3
=
_ref3
.
length
;
_l
<
_len3
;
_l
++
)
{
el
=
_ref3
[
_l
];
bodyParam
.
append
(
$
(
el
).
attr
(
'
name
'
),
el
.
files
[
0
]);
}
console
.
log
(
bodyParam
);
this
.
invocationUrl
=
this
.
model
.
supportHeaderParams
()
?
(
headerParams
=
this
.
model
.
getHeaderParams
(
map
),
this
.
model
.
urlify
(
map
,
false
))
:
this
.
model
.
urlify
(
map
,
true
);
$
(
"
.request_url
"
,
$
(
this
.
el
)).
html
(
"
<pre>
"
+
this
.
invocationUrl
+
"
</pre>
"
);
...
...
@@ -1698,14 +1700,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView
.
prototype
.
getSelectedValue
=
function
(
select
)
{
var
opt
,
options
,
_i
,
_len
,
_ref
5
;
var
opt
,
options
,
_i
,
_len
,
_ref
;
if
(
!
select
.
multiple
)
{
return
select
.
value
;
}
else
{
options
=
[];
_ref
5
=
select
.
options
;
for
(
_i
=
0
,
_len
=
_ref
5
.
length
;
_i
<
_len
;
_i
++
)
{
opt
=
_ref
5
[
_i
];
_ref
=
select
.
options
;
for
(
_i
=
0
,
_len
=
_ref
.
length
;
_i
<
_len
;
_i
++
)
{
opt
=
_ref
[
_i
];
if
(
opt
.
selected
)
{
options
.
push
(
opt
.
value
);
}
...
...
@@ -1793,9 +1795,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
padding
=
''
;
indent
+=
transitions
[
fromTo
];
padding
=
((
function
()
{
var
_j
,
_ref
5
,
_results
;
var
_j
,
_ref
,
_results
;
_results
=
[];
for
(
j
=
_j
=
0
,
_ref
5
=
indent
;
0
<=
_ref
5
?
_j
<
_ref
5
:
_j
>
_ref
5
;
j
=
0
<=
_ref
5
?
++
_j
:
--
_j
)
{
for
(
j
=
_j
=
0
,
_ref
=
indent
;
0
<=
_ref
?
_j
<
_ref
:
_j
>
_ref
;
j
=
0
<=
_ref
?
++
_j
:
--
_j
)
{
_results
.
push
(
'
'
);
}
return
_results
;
...
...
@@ -1862,11 +1864,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
StatusCodeView
=
(
function
(
_super
)
{
__extends
(
StatusCodeView
,
_super
);
function
StatusCodeView
()
{
_ref5
=
StatusCodeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref5
;
StatusCodeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
StatusCodeView
.
prototype
.
initialize
=
function
()
{};
...
...
@@ -1887,11 +1889,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
ParameterView
=
(
function
(
_super
)
{
__extends
(
ParameterView
,
_super
);
function
ParameterView
()
{
_ref6
=
ParameterView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref6
;
ParameterView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
ParameterView
.
prototype
.
initialize
=
function
()
{};
...
...
@@ -1968,11 +1970,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
SignatureView
=
(
function
(
_super
)
{
__extends
(
SignatureView
,
_super
);
function
SignatureView
()
{
_ref7
=
SignatureView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref7
;
SignatureView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
SignatureView
.
prototype
.
events
=
{
...
...
@@ -2037,11 +2039,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
ContentTypeView
=
(
function
(
_super
)
{
__extends
(
ContentTypeView
,
_super
);
function
ContentTypeView
()
{
_ref8
=
ContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref8
;
ContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
ContentTypeView
.
prototype
.
initialize
=
function
()
{};
...
...
@@ -2063,11 +2065,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
ResponseContentTypeView
=
(
function
(
_super
)
{
__extends
(
ResponseContentTypeView
,
_super
);
function
ResponseContentTypeView
()
{
_ref9
=
ResponseContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref9
;
ResponseContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
ResponseContentTypeView
.
prototype
.
initialize
=
function
()
{};
...
...
@@ -2089,11 +2091,11 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
})(
Backbone
.
View
);
ParameterContentTypeView
=
(
function
(
_super
)
{
__extends
(
ParameterContentTypeView
,
_super
);
function
ParameterContentTypeView
()
{
_ref10
=
ParameterContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
_ref10
;
ParameterContentTypeView
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
ParameterContentTypeView
.
prototype
.
initialize
=
function
()
{};
...
...
dist/swagger-ui.min.js
View file @
fc0ccd44
This diff is collapsed.
Click to expand it.
src/main/coffeescript/view/OperationView.coffee
View file @
fc0ccd44
...
...
@@ -132,7 +132,7 @@ class OperationView extends Backbone.View
console
.
log
headerParams
# add files
$
.
each
$
(
'input[type~="file"]'
)
,
(
i
,
el
)
->
for
el
in
form
.
find
(
'input[type~="file"]'
)
bodyParam
.
append
(
$
(
el
).
attr
(
'name'
),
el
.
files
[
0
])
console
.
log
(
bodyParam
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment