mirror of
https://github.com/actions/setup-node.git
synced 2025-07-27 08:58:24 +02:00
.
This commit is contained in:
parent
beb1329f9f
commit
2b95e76931
7736 changed files with 1874747 additions and 51184 deletions
18
node_modules/@octokit/rest/plugins/authentication/with-authorization-prefix.js
generated
vendored
18
node_modules/@octokit/rest/plugins/authentication/with-authorization-prefix.js
generated
vendored
|
@ -1,23 +1,23 @@
|
|||
module.exports = withAuthorizationPrefix
|
||||
module.exports = withAuthorizationPrefix;
|
||||
|
||||
const atob = require('atob-lite')
|
||||
const atob = require("atob-lite");
|
||||
|
||||
const REGEX_IS_BASIC_AUTH = /^[\w-]+:/
|
||||
const REGEX_IS_BASIC_AUTH = /^[\w-]+:/;
|
||||
|
||||
function withAuthorizationPrefix (authorization) {
|
||||
function withAuthorizationPrefix(authorization) {
|
||||
if (/^(basic|bearer|token) /i.test(authorization)) {
|
||||
return authorization
|
||||
return authorization;
|
||||
}
|
||||
|
||||
try {
|
||||
if (REGEX_IS_BASIC_AUTH.test(atob(authorization))) {
|
||||
return `basic ${authorization}`
|
||||
return `basic ${authorization}`;
|
||||
}
|
||||
} catch (error) { }
|
||||
} catch (error) {}
|
||||
|
||||
if (authorization.split(/\./).length === 3) {
|
||||
return `bearer ${authorization}`
|
||||
return `bearer ${authorization}`;
|
||||
}
|
||||
|
||||
return `token ${authorization}`
|
||||
return `token ${authorization}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue