Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint to allow pulling log files from the web_interface #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

@@ -1113,4 +1209,14 @@ function isJson(str) {
return str
}

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.

None yet

2 participants