mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-23 21:46:27 +02:00
make version optional
This commit is contained in:
parent
37e83c9813
commit
21a0c60f5d
3 changed files with 8 additions and 6 deletions
|
@ -69,9 +69,9 @@ function get_job(body) {
|
|||
message: 'language is required as a string',
|
||||
});
|
||||
}
|
||||
if (!version || typeof version !== 'string') {
|
||||
if (version && typeof version !== 'string') {
|
||||
return reject({
|
||||
message: 'version is required as a string',
|
||||
message: 'version should be a string',
|
||||
});
|
||||
}
|
||||
if (!files || !Array.isArray(files)) {
|
||||
|
@ -93,7 +93,9 @@ function get_job(body) {
|
|||
);
|
||||
if (rt === undefined) {
|
||||
return reject({
|
||||
message: `${language}-${version} runtime is unknown`,
|
||||
message: `${language}${
|
||||
version ? `-${version}` : ''
|
||||
} runtime is unknown`,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ module.exports.get_runtimes_matching_language_version = function (lang, ver) {
|
|||
return runtimes.filter(
|
||||
rt =>
|
||||
(rt.language == lang || rt.aliases.includes(lang)) &&
|
||||
semver.satisfies(rt.version, ver)
|
||||
(typeof ver !== 'string' || semver.satisfies(rt.version, ver))
|
||||
);
|
||||
};
|
||||
module.exports.get_latest_runtime_matching_language_version = function (
|
||||
|
@ -211,7 +211,7 @@ module.exports.get_runtime_by_name_and_version = function (runtime, ver) {
|
|||
rt =>
|
||||
(rt.runtime == runtime ||
|
||||
(rt.runtime === undefined && rt.language == runtime)) &&
|
||||
semver.satisfies(rt.version, ver)
|
||||
(typeof ver !== 'string' || semver.satisfies(rt.version, ver))
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue