Skip to content

Commit

Permalink
Merge pull request #5910 from Countly/system-utility-profiler-files-n…
Browse files Browse the repository at this point in the history
…ot-found-error

[system-utility] Profiler files not found error
  • Loading branch information
ArtursKadikis authored Jan 13, 2025
2 parents 00cc8d7 + 7654d16 commit 9066b02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Fixes:
- [core] Fixed a bug causing events to not being loaded when there's an escaped character in the event name
- [gridfs] fixes for moving to Promises
- [system-utility] Fixed: Mongo error (code: 26) in some Countly instances when the profiler gets run for the first time
- [surveys] "Select one" text in the widget can be edited now

Dependencies:
Expand Down
17 changes: 11 additions & 6 deletions plugins/system-utility/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,17 @@ function stopWithTimeout(type, fromTimeout = false) {
validate(params, async() => {
try {
const tarStream = await systemUtility.profilerFilesTarStream();
params.res.writeHead(200, {
"Content-Type": "plain/text; charset=utf-8",
"Content-Disposition": "attachment; filename=profiler.tar"
});
tarStream.on("end", () => params.res.end());
tarStream.pipe(params.res);
if (tarStream === null) {
common.returnMessage(params, 404, "Profiler files not found");
}
else {
params.res.writeHead(200, {
"Content-Type": "plain/text; charset=utf-8",
"Content-Disposition": "attachment; filename=profiler.tar"
});
tarStream.on("end", () => params.res.end());
tarStream.pipe(params.res);
}
}
catch (err) {
log.e(err);
Expand Down

0 comments on commit 9066b02

Please sign in to comment.