Skip to content

Commit

Permalink
Update zipfile naming logic
Browse files Browse the repository at this point in the history
  • Loading branch information
elmiomar committed Nov 22, 2024
1 parent f87ccdc commit aa89448
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions angular/src/app/datacart/bundleplan/bundleplan.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,13 @@ export class BundleplanComponent implements OnInit {
this.downloadService.download(zip, this.zipData, this.dataCart);
}

private generateZipFileName(base : string = null) : string {
const MIN : number = 0;
const MAX : number = 100000;
let suffix = Math.floor(Math.random() * (MAX - MIN + 1)) + MIN;
return base + suffix;
}
private generateZipFileName(base: string = "NIST-Data"): string {
// current timestamp
const now = new Date();
const timestamp = now.toISOString().slice(0, 16).replace(":", "-");

return `${base}-${timestamp}`;
}

/**
* download the selected files from this cart.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ export class DownloadService {
// create the request body
let reqfiles = [];
for (let item of files) {
let resId = item.resId;
let filePath = item.filePath;
console.log(`resId: ${resId}, filePath: ${filePath}`);

reqfiles.push({
"filePath": item.resId + '/' + item.filePath,
"downloadUrl": item.downloadURL
Expand Down

0 comments on commit aa89448

Please sign in to comment.