Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ProcessMaker/Http/Controllers/Api/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ public function download(Request $request, string $type, int $id)
$payload = $exporter->encrypt($password, $payload);
}

$filename = strtolower(str_replace(' ', '_', $payload['name'])) . '.json';

return response()->streamDownload(
function () use ($payload) {
echo json_encode($payload);
},
$payload['name'] . '.json',
$filename,
[
'Content-type' => 'application/json',
'export-info' => $exported,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/processes/export/DataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", exportInfo.name.replace(' ', '_') + ".json");
link.setAttribute("download", exportInfo.name.replace(/ /g, "_").toLowerCase() + ".json");
document.body.appendChild(link);
link.click();
return exportInfo;
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ImportExport/Api/ExportImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ExportImportTest extends TestCase

public function testDownloadExportFile()
{
$screen = Screen::factory()->create(['title' => 'Screen']);
$screen = Screen::factory()->create(['title' => 'Screen With Space']);

$response = $this->apiCall(
'POST',
Expand All @@ -51,7 +51,7 @@ public function testDownloadExportFile()

// Ensure we can download the exported file.
$response->assertStatus(200);
$response->assertHeader('content-disposition', "attachment; filename={$screen->title}.json");
$response->assertHeader('content-disposition', 'attachment; filename=screen_with_space.json');

// Ensure it's encrypted.
$payload = json_decode($response->streamedContent(), true);
Expand Down