Skip to content

Conversation

@pwcushman
Copy link
Contributor

No description provided.

Comment on lines +1071 to +1088
var authHeader = req.get("Authorization")
var authToken
if (authHeader) {
if (authHeader.indexOf(" ") == -1) {
authToken = authHeader
} else {
authHeader = authHeader.split(" ")
authToken = authHeader[1]
}
} else {
res.set("Authorization", "Basic base64_auth_token")
return res
.type("txt")
.status(401)
.send(
'Access denied: invalid Authorization Header format. Correct format: "Authorization: Basic base64_auth_token"'
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I absolutely sure that this part can be carried out from each route, avoiding terrible code repetition!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that is true. We will add that to the list of things to address.

try {
var logAndOutputFiles = []
const tarFile = 'LogAndOutputFiles.tar'
const userAttachments = process.cwd() + "/attachments"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work at Windows OS. You should use path object to join paths.


function checkForLog(fileName, pathName, destDir, list) {
if (!fs.existsSync(pathName)) {
console.log('get logs: cannot find:' + pathName)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is much better to use return after this line and avoid using else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants